shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.2k stars 1.34k forks source link

Preroll fails with VMAP, if autoplay is disabled #4800

Closed Andekas closed 1 year ago

Andekas commented 1 year ago

Have you read the FAQ and checked for duplicate open issues?

Yes

What version of Shaka Player are you using?

4.3.0.

Can you reproduce the issue with our latest release version?

Yes

Can you reproduce the issue with the latest code from main?

Yes

Are you using the demo app or your own custom app?

Tried with both

If custom app, can you reproduce the issue using our demo app?

Yes -

What browser and OS are you using?

Windows 10, Chrome

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

Doesn't matter; tested with https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd

What configuration are you using? What is the output of player.getConfiguration()?

What did you do?

In the demo site, it's enough to insert Manifest URL and samle Ad TAG URL. I used IMA sample tag from Google ( https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags ).

VMAP - Pre-roll Single Ad, Mid-roll Standard Pod with 3 ads, Post-roll Single Ad https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostpod&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator=

What did you expect to happen? Preroll should play first

What actually happened?

If autoplay is allowed, everything works as expected.

If autoplay is not allowed (or is disabled) preroll ads won't play. Post- and midrolls play well.

Ads get showed for few ms, then player pauses (but the state is still play; at least the button on the control bar is "pause" instead of "play").

Easy way to reproduce this is to refresh demo page with video open.

Seems to be related to https://github.com/shaka-project/shaka-player/issues/4179

Andekas commented 1 year ago

Nope, still has problems.

When autoplay is not enabled, but video has preroll ads, then ads still try to autoplay and thus fail.

If autoplay is allowed by browser or video is muted, then everyting works.

Quick fix would be to load videos after video has started playing:

eventManager.listenOnce(video,play, () => { adManager.requestClientSideAds(adsRequest); });