Stop JWPlayer ad playback

纵然是瞬间 提交于 2019-12-11 06:12:51

问题


I can't seem to make jwplayer (version 6) stop playback while it's playing an ad. jwplayer().stop() and pause() does absolutely nothing.

Are there any ad-specific playback control methods? Can't find them in the documents.


回答1:


For a non-VPAID ad

You can pause the ad by calling jwplayer().play().

a. To see this workaround, you can use this test page: http://support.jwplayer.com/customer/portal/articles/1431665-basic-preroll-video-ads

b. If you want to use this technique, you need to know the active state of the ad in the player, because you might end up making the ad resume and not pause (which would be the opposite of what you want). Your first inclination might be jwplayer().getState() but this won't work because that will return the state of the video content and NOT the state of the ad. To work around this issue, you can keep track of the ad's state manually by listening to the onAdPlay hook and it's siblings.

For a VPAID ad

You can't pause/stop the ad at all.

To answer Ethan's question about a page to reproduce:

i. Go to http://support.jwplayer.com/customer/portal/articles/1434330-vpaid-interactive-pre-roll

ii. Open the developer console

iii. Execute this command: jwplayer().play() and note how the player starts playing the ad (which is good)

iv. Execute this command: jwplayer.play() and note how the player won't pause (which is bad)

For step "iv", you can also try jwplayer.pause() and jwplayer.stop(). None of them will stop the VPAID ad.

Update

I am working with jwplayer on this issue, but for a VPAID ad here is a workaround which I've had some success with:

jwplayer().callInternal("jwCallVPAID", "pauseAd");

Note: This will only work if the VPAID creative has implemented a "pause" function which can be called externally, which they might not have.

You can also call "resumeAd" and "stopAd" in a similar fashion.



来源:https://stackoverflow.com/questions/22202139/stop-jwplayer-ad-playback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!