googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
454 stars 285 forks source link

Preroll freeze on first frame. #462

Closed anton-asnitsky closed 6 years ago

anton-asnitsky commented 6 years ago

Hi all, I have some strange issue. Working on videojs v6.5.0, videojs-contrib-ads v5.1.5 and videojs-ima v0.8.0.

Trying to play prerloll from DFP vast: http://pubads.g.doubleclick.net/gampad/ads?env=vp&gdfp_req=1&impl=s&output=vast&unviewed_position_start=1&iu=/43010785/walla/travel/aroundtheworld/pre_phone&url=http://www.somedomain.com/item/3111494&correlator=15131781174113&description_url=http%3A%2F%2Fwww.somedomain.com%2Fitem%2F3111494&sz=340x192&vad_type=linear&scor=5a3146722f44f&cust_params=slot_name%3Dpre_phone%26age%3Dtaboola%2520global%253Auser-id%253Dfee9bb50-2762-4ad4-bd3d-e56d635dcd72-tuct12ac5b5%26app_version%3D0%26gender%3DO%26auto_refresh%3D1%26ssl%3Dno%26show_interstitial%3D0%26page_type%3Ditem%26first_view%3Dno%26sponsorship%3Dno%26login%3Dno%26adb%3Dno%26topic%3D%D7%90%D7%95%D7%96%D7%91%D7%A7%D7%99%D7%A1%D7%98%D7%9F%26agegroup%3D99%26mobile%3D0%26item_id%3D3111494%26target_audiance%3D1%2C3%2C5%2C2%2C9%26vertical_id%3D14%26category_id%3D12113%26item_type%3Dplayer%26affiliate%3DShutterStock%26exclusive%3Dpegasus%26providerId%3D513%26vertical_name%3Dtourism (if this one returns empty change the correlator param to something else) on Android google chrome(Galaxy S8). I see that ad request run well and i get preroll media but when it comes to play it stucks on a first frame, waits for timeout of 15 ecs and then gracefully returns to main playback which plays without any issues. In a console I get next output:

build.js?b=1510479868:489 VIDEOJS: ads play triggered: content-set -> ads-ready? build.js?b=1510479868:489 VIDEOJS: ads adsready triggered: ads-ready? -> preroll? build.js?b=1510479868:489 VIDEOJS: ads adtimeout triggered: preroll? -> content-playback build.js?b=1510479868:489 VIDEOJS: ads adstart triggered: content-playback -> ad-playback ima3.js:281 Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.h.Bb @ ima3.js:281Vp.M @ ima3.js:326Mf @ ima3.js:85P @ ima3.js:83Hp.B @ ima3.js:314Jf @ ima3.js:81Gf @ ima3.js:82(anonymous function) @ ima3.js:79 build.js?b=1510479868:50405 Ad error: AdError 402: VAST media file loading reached a timeout of 15 seconds. build.js?b=1510479868:489 VIDEOJS: ads adend triggered: ad-playback -> content-resuming build.js?b=1510479868:489 VIDEOJS: ads adserror triggered: ad-playback -> content-resuming build.js?b=1510479868:489 VIDEOJS: ads playing triggered: content-resuming -> content-playback build.js?b=1510479868:489 VIDEOJS: ads contentended triggered: content-playback -> postroll? build.js?b=1510479868:489 VIDEOJS: ads adtimeout triggered: postroll? -> content-resuming build.js?b=1510479868:489 VIDEOJS: ads ended triggered: content-resuming -> content-playback

Player triggered to play video by touched event...

Any ideas, anybody? What can be a problem here? Thanks for helping...

shawnbuso commented 6 years ago

Hmm, it looks like videojs-contrib-ads 5.1.5 only supports up to video.js version 5.19.2. Are you seeing the same issue if you downgrade the player version?

anton-asnitsky commented 6 years ago

Downgraded to videojs 5.20.1 - same things happens.

luisasensio commented 6 years ago

Hello,

Im trying an initial integration with videojs & ima plugin and I'm having the same issue (I think).

Originally I had same versions than @anton-asnitsky, today I downgrade the player to 5.19.2 and same happens.

Sorry but public test page is not available yet, if it can helps, I reproduced it in Android 6.0.1 with FF but worked in iOS 10.3.3 with Safary and Chrome

Regards.

shawnbuso commented 6 years ago

If you're seeing this issue on mobile, the likely cause is that you're not calling player.ima.initializeAdDisplayContainer() as the result of a user action.

@luisasensio can you confirm that you are calling that on a user action?

@anton-asnitsky are you seeing this issue on mobile and desktop, or just mobile? If it's just mobile, this could be your issue as well.

luisasensio commented 6 years ago

Yes! It works!! Thanks so much @shawnbuso. It works even upgrading videojs to 6.5 again.

Just one question... if an user action is necessary, does it incompatible with an autoplay configuration??

Anyway, thanks again!!

shawnbuso commented 6 years ago

On mobile, yes. This is not a limitation of the plugin but rather a requirement imposed by mobile browsers. If your video has audio and is un-muted, mobile browsers require a user interaction to start playing it.

anton-asnitsky commented 6 years ago

@shawnbuso We seeing this issue only on mobile. On desktop it works just fine. What do you mean "as the result of a user action"? Touched event is enough?

ypavlotsky commented 6 years ago

'As a result of user action' on mobile just means that it has to be directly called from the event handler, such as the one for the 'touchend' event.

yourchoice commented 6 years ago

Same happen on my case even I have, ad freeze (I have last versions via npm):

player.one(startEvent, function() {
    player.ima.initializeAdDisplayContainer();
});
anton-asnitsky commented 6 years ago

Ok. We're good now. Changed ad triggering aevent to touchend and all wprks fine now, Thanks a lot.