-
Notifications
You must be signed in to change notification settings - Fork 284
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
Add robust support for autoplay on platforms that may prevent it #341
Comments
We are currently working on it and hope to have support in the IMA SDK soon. Once support is added to the SDK we should be able to get it added to the plugin relatively easily. |
That's good to hear. In the mean time I've used a bit of a hack to make it work, in case it can help others if (isMobileDevice) {
var $video = $.find('.my-identifier-class video');
// Might be optional, but I needed this because the attr solution
// wasn't autoplaying on ios still
$video[0].muted = true;
// This line was needed to make mobile work even though I had set autoplay and
// muted both to true on the videojs initial settings and on the DOM I can
// see these attributes already exists
$video.attr({ muted: 'muted', autoplay: 'autoplay' });
// Might be optional, but I needed it to make android not freeze on ad finish/new video
// Apparently it's also not fired on ios, but it wasn't needed on ios anyways...
$video.one('canplay', function() { $video.removeAttr('muted'); });
} I also created a unmute button that when clicked unmutes both the video and the ad video player (using similar hacks as above) It's not pretty, but autoplay works everywhere for me right now. Hopefully official support comes soon! |
It seems the most recent release of IMA SDK comes with autoplay support. |
Just got around to testing it out, and it does seem like autoplay works out of the box now without the hacks I created before. |
It's worked for iOS for awhile, but is it working with Android? |
I see it's working on ios and android for normal VAST tags, but VPAID ads are not working right. The extra player the IMA SDK is creating for the ads does not have 'muted' or 'autoplay' attributes on them. Using the hack above + a timeout of 500ms, I can make android work. No luck with iOS. Also, after clicking the VPAID ad, then returning and resuming the ad through the api |
I'm seeing several creatives that are their own player on Android that put a big ol' monkey wrench in everything. That said, it's playing certain creatives flawlessly on Android, which is pretty great. @shawnbuso Do you have plans for these creatives (the ones with their own players)? Is there a way to get them playing automatically in the SDK/plugin? |
So I've created a demo github repo to show some issues. Autoplay is working for me in most cases, but as shown in issue 2 there, it does not work for our vpaid ad. |
Hi all, The IMA SDK just recently released support for autoplay on mobile. We'll need to do some testing in this plugin to see if it just works out of the box or if there's more work to be done on our end, but we'll keep you posted. Thanks! |
That's great @shawnbuso! Do you have any code examples to accomplish auto-play on mobile? |
Not yet but they are in the works - I'll add a sample once I have it finalized. |
Hi I have included ads.js file at the bottom of index page above. |
Hi there - are you using the video.js plugin? It looks like you just have your own IMA implementation, in which case you'll want to look for help on the IMA SDK support forum. This issue tracker is only for supporting the video.js plugin for IMA. |
@neemak Make sure your player is muted. If you are working with VPAID, also make sure the creative didn't change on the volume before ad being started. |
Hi, help us to resolve this issue asap. |
Hi, which device and os are you testing on? I tested on an up-to-date Android phone and it's working for me. When you see a problem, what is the specific issue that you're seeing? |
Hi, help us to resolve this issue asap. |
Thanks for the info - right now we have an issue somewhere between the video.js player, videojs-contrib-ads, and videojs-ima that causes autoplay to break if it's disallowed by the browser. We're going to work with the folks from the other projects to try to figure out where the issue lies and get it resolved. |
Hi |
Hi - this issue is specific to troubleshooting autoplay on mobile. Could you open a new issue for this question? Thanks! |
I've filed videojs/videojs-contrib-ads#319 to work with the contrib-ads folks to see how we can better handle browser-prevented autoplay. |
FYI I've changed the title of this submission since this same issue now applies to non-mobile platforms that also prevent autoplay (like desktop Safari, and soon desktop Chrome). |
It looks like we won't be able to handle this completely within the player, because video.js and contrib-ads don't have great support for falling back to click to play when autoplay fails. Instead I'm updating the autoplay sample to show how you can do this for yourself using can-autoplay. |
FWIW, VideoJS 6 is adding (has added) can-autoplay. I'll try to find the PR/Issue. |
Ah interesting, I did not know that - I'll see if I can use the one they have included instead. |
Sorry, I misspoke. There was talk of adding it in the VideoJs Slack board but I guess it isn't/hasn't been adopted yet. |
Ah ok no worries - for now I'll just load the library myself in the autoplay example. |
#562) * refactor: Update autoplay sample and how we report adsWillAutoplay and adsWillPlayMuted. Also deprecates the options ad(s)WillPlayMuted and ad(s)WillAutoPlay. Fixes #341. * Update README to indicate that setAdWillPlayMuted is deprecated. * Use getPlayerOptions() instead of vjsPlayer.options_ in controller getAdsWillAutoplay. * Add can-autoplay to release script for gh-pages. * Move can-autoplay from devDependencies to dependencies. I feel like if it's required to run the samples then it should probably be in dependencies. * Fix lint errors. * Move accidental extra file. * Fix example - check unmuted support first, then muted.
googleads#562) * refactor: Update autoplay sample and how we report adsWillAutoplay and adsWillPlayMuted. Also deprecates the options ad(s)WillPlayMuted and ad(s)WillAutoPlay. Fixes googleads#341. * Update README to indicate that setAdWillPlayMuted is deprecated. * Use getPlayerOptions() instead of vjsPlayer.options_ in controller getAdsWillAutoplay. * Add can-autoplay to release script for gh-pages. * Move can-autoplay from devDependencies to dependencies. I feel like if it's required to run the samples then it should probably be in dependencies. * Fix lint errors. * Move accidental extra file. * Fix example - check unmuted support first, then muted.
I made a comment about it on #281 but thought a new ticket would be more appropriate.
Is there any work ongoing to make autoplay on android and ios work properly?
I've done a small modification to the advanced example to autoplay and it works great on desktop but in chrome on android and safari on ios the ad gets stuck right as it loads the first frame. Looking at the console logs and the inspector, it seems the ads are playing in a separate video element loaded within an iframe (or 2) and do not have the required attributes for 'autoplay muted' (and 'playsinline' for ios) as specified in these articles
https://webkit.org/blog/6784/new-video-policies-for-ios/
https://developers.google.com/web/updates/2016/07/autoplay
The text was updated successfully, but these errors were encountered: