Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose more of vrs methods #10

Merged
merged 2 commits into from
Aug 7, 2017
Merged

feat: expose more of vrs methods #10

merged 2 commits into from
Aug 7, 2017

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Aug 4, 2017

  • Debugging was a pain without access to all the currently private variables
  • Some of the variables need to be accessed again when we change videos

fix: switching a source should not create two canvases
fix: loading via player.src and video element source should work
fix: switching between 360 and non-360 sources with AUTO should work Fixes #8
fix: allow Sphere/Cube as mediainfo projections

@@ -18,7 +18,11 @@
<script>
(function(window, videojs) {
var player = window.player = videojs('videojs-vr-player');
player.vr({projection: '360', debug: true});
player.mediainfo = player.mediainfo || {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched the demo to mediainfo as that is probably the best way to do it (unless you only have one video)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the way mediainfo has leaked out of the Brightcove Player and into a couple of our open source projects. Is there a different/better way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may be able to read spacial metadata from the video file. I am not sure that would work for HLS or if we even have access to it for mp4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Ignore me, I don't think it's a big deal. It's not BC-specific.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't a leak, it was a conscious decision. At least for ads.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, it seems to me like it might be possible to get rid of the mediainfo usage? Just do everything through the VR options and also expose it via player.vr.projection? Then update usage of current mediainfo to reflect that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we are dealing with switching media (I.E 360 video switches to non-360 or vice versa), it is not possible to tell wether a video is 360 or not. We could manually set it with player.vr.projection but it seems like it would be better to have a flag in the media itself that tells the player that the source is 360.

};

const vr = function(options) {
this.ready(() => initPlugin(this, options));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not waiting for player.ready caused issues on iOS devices when the source was set in the video element. Presumable because of async source setting in video.js 6

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely.

fix: switching a source should not create two canvases
fix: loading via player.src and video element source should work
fix: switching between 360 and non-360 sources with AUTO should work
fix: allow Sphere/Cube as mediainfo projections
}
});
// mobile devices
if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IS_IPAD and IS_IOS are the same thing


player.ready(function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to wait for ready since the entire function does this now


player.on('loadstart', function() {
initScene();
player.on('loadedmetadata', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to re-init the scene every video, but only when we know how big the video will be.

}

function initScene() {
/* reset player.vr to a default un-initialized state */
player.vr.reset = function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset the vr plugin in-between inits, so that if the source is not 360 we don't mess with it.


// don't initialize twice
if (this.usingPlugin('vr')) {
if (player.vr && player.vr.currentProjection) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usingPlugin wasn't consistent for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember why/how? We probably should open a bug for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I may just have had the if check in the wrong place. It should probably go below all the error checking return statements. I also think that having it here would probably work now because the plugin waits for player.ready

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to expose all the functions and settings publicly? I guess this makes it easier to debug and test?

@@ -18,7 +18,11 @@
<script>
(function(window, videojs) {
var player = window.player = videojs('videojs-vr-player');
player.vr({projection: '360', debug: true});
player.mediainfo = player.mediainfo || {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't a leak, it was a conscious decision. At least for ads.


// don't initialize twice
if (this.usingPlugin('vr')) {
if (player.vr && player.vr.currentProjection) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember why/how? We probably should open a bug for this.

};

const vr = function(options) {
this.ready(() => initPlugin(this, options));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely.

@@ -18,7 +18,11 @@
<script>
(function(window, videojs) {
var player = window.player = videojs('videojs-vr-player');
player.vr({projection: '360', debug: true});
player.mediainfo = player.mediainfo || {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, it seems to me like it might be possible to get rid of the mediainfo usage? Just do everything through the VR options and also expose it via player.vr.projection? Then update usage of current mediainfo to reflect that?

@brandonocasey
Copy link
Contributor Author

I think exposing it all makes sense, I think it could be useful in many ways

@brandonocasey brandonocasey merged commit 3cc1092 into master Aug 7, 2017
@brandonocasey brandonocasey deleted the feat/expose-more branch August 7, 2017 18:10
mister-ben pushed a commit to mister-ben/videojs-vr that referenced this pull request Dec 4, 2023
chore: Swap webvr for webxr polyfill packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reset the VRDisplay between videos
3 participants