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

Fix/ios preroll #115

Merged
merged 6 commits into from
Aug 8, 2018
Merged

Fix/ios preroll #115

merged 6 commits into from
Aug 8, 2018

Conversation

brandonocasey
Copy link
Contributor

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.

@@ -535,14 +553,17 @@ class VR extends Plugin {

if (this.controls3d) {
this.controls3d.dispose();
this.controls3d = null;
Copy link
Contributor Author

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.

@gkatsev
Copy link
Member

gkatsev commented Jul 24, 2018

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 ?
We probably want to reset VR when videoElementRecyled is true in contrib-ads, rather than just on iOS, no?

@brandonocasey
Copy link
Contributor Author

Yeah we probably want to set it whenever videoElementRecycled is true. I would think we would want this plugin to know about ads and not the other way around.

@gkatsev
Copy link
Member

gkatsev commented Jul 25, 2018

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(() => {
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 have to wait 1 tick after adstart so that we can tell if the video element was recycled or not

Copy link
Member

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

Copy link
Member

@misteroneill misteroneill left a 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);
}
Copy link
Member

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?

Copy link
Contributor Author

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(() => {
Copy link
Member

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') {
Copy link
Member

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)?

Copy link
Member

Choose a reason for hiding this comment

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

BEATEN! 😛

@apadhye
Copy link

apadhye commented Aug 6, 2018

QA LGTM

@brandonocasey brandonocasey merged commit 4292fae into master Aug 8, 2018
@brandonocasey brandonocasey deleted the fix/ios-preroll branch August 8, 2018 16:31
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.

4 participants