-
Notifications
You must be signed in to change notification settings - Fork 147
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
Conversation
@@ -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 || {}; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
0ae2e48
to
59b4c43
Compare
} | ||
}); | ||
// mobile devices | ||
if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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 || {}; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 || {}; |
There was a problem hiding this comment.
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?
I think exposing it all makes sense, I think it could be useful in many ways |
chore: Swap webvr for webxr polyfill packages
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