-
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
Fix/ios preroll #115
Fix/ios preroll #115
Conversation
@@ -535,14 +553,17 @@ class VR extends Plugin { | |||
|
|||
if (this.controls3d) { | |||
this.controls3d.dispose(); | |||
this.controls3d = null; |
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.
mostly we needed this change, since we check to see if this variable exists before adding orbit orientation controls, and even with dispose it will still exist.
So, should we have the reset code for ads here or should the ad plugins know to reset the VR plugin when enabled? Thoughts @incompl ? |
Yeah we probably want to set it whenever |
We have been trying to keep all ad-related code contained. I'm not sure where it is necessarily better, though. |
src/plugin.js
Outdated
@@ -83,6 +83,27 @@ class VR extends Plugin { | |||
|
|||
this.setProjection(this.options_.projection); | |||
|
|||
// any time the video element is recycled for ads | |||
// we have to reset the vr state and re-init after ad | |||
this.on(player, 'adstart', () => window.setTimeout(() => { |
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 have to wait 1 tick after adstart so that we can tell if the video element was recycled or not
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 should use player.setTimeout
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.
Looks good. One minor question.
src/plugin.js
Outdated
videojs.log('VR: ' + msg); | ||
} else { | ||
videojs.log('VR: ', msg); | ||
} |
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.
Can't you just do videojs.log('VR: ', msg);
without the code fork? Should be the same end result, no?
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
src/plugin.js
Outdated
@@ -83,6 +83,27 @@ class VR extends Plugin { | |||
|
|||
this.setProjection(this.options_.projection); | |||
|
|||
// any time the video element is recycled for ads | |||
// we have to reset the vr state and re-init after ad | |||
this.on(player, 'adstart', () => window.setTimeout(() => { |
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 should use player.setTimeout
src/plugin.js
Outdated
@@ -240,7 +261,11 @@ class VR extends Plugin { | |||
} | |||
|
|||
msgs.forEach((msg) => { | |||
videojs.log(msg); | |||
if (typeof msg === 'string') { |
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.
why not always do videojs.log('VR:', msg)
?
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.
BEATEN! 😛
QA LGTM |
Reset needs to null out variables and dispose, just dispose won't actually reset the plugin.
IOS has a special case for many ad plugins that we have to handle.