MailOnline / videojs-vast-vpaid

video.js vast plugin
MIT License
296 stars 232 forks source link

Play Ads on ContentEnds #266

Open jonathanbrenman opened 7 years ago

jonathanbrenman commented 7 years ago

Hi all, I'm trying to play an Ad let call ad1 at the video start and when the video ends other Ad let call ad2 from other URL. I'm doing this but The ad wont play in the end.

<div class="wrapper">
    <div id="video">
        <video id="media_player" class="video-js vjs-default-skin" controls  preload="false">
            <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4" />                       
        </video>
    </div>
</div>
<script>
    var videoUrl = window.location.href;
    var player = videojs('media_player');                                       
    player.vastClient({
        adTagUrl: 'my-url​',
            "vpaidFlashLoaderPath": "libs/videojs-vast-vpaid/VPAIDFlash.swf?raw=true"
    });
    player.on('reset', function () {
        console.log("reset");
        if (!player.vast.isEnabled()) {
            player.vast.enable();
        } else {
            player.vast.disable();
        }
    });
    player.on("vast.contentEnd", function () {
        console.log("content end");
        player.vastClient({
            adTagUrl: 'my-url',
            playAdAlways: true,
        }); 
        player.trigger("vast.reset");
        player.trigger("vast.firstPlay");               
    });
</script> 

I received an error: How can I reintance the vastClient plugin??

[videojs-vast-vpaid] AD ERROR: VAST Error: timeout while waiting for the video to start playing VASTError {message: "VAST Error: timeout while waiting for the video to start playing", code: 402} undefined

jonathanbrenman commented 7 years ago

I already did that the ads plays again, now I need to know how to change the ad source in runtime, anyone can help with that? The reset do not working for this I already tried.

Thanks

ndabAP commented 7 years ago

I already did that the ads plays again

@jonathanbrenman, can you tell us how did you achieve this?

yaronlp1 commented 6 years ago

@jonathanbrenman A year old, but still a missing piece. Did you find out how to update the ad source on runtime?