Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Problem occuring when using it second time #75

Open
nafisakanwal opened this issue May 8, 2015 · 2 comments
Open

Problem occuring when using it second time #75

nafisakanwal opened this issue May 8, 2015 · 2 comments

Comments

@nafisakanwal
Copy link

Can we add ad at multiple times in a one video
because when i am using it second time , its giving me error, i dont know whats wrong,Please help me out of this !
Here is my code snippet

player.ads();
player.vast({
url: http://videoads.theonion.com/vast/270.xml';
});

Its is working only one time . i have to display ad as a preroll , mid roll and post roll , but when i use it second time it occurred this error
TypeError: player.ads is not a function
Please help me

@Manbearpixel
Copy link

Hey @nafisakanwal

So the .ads is actually an object created by videojs.ads.js and thus would result in a JS error if you're trying to call it as a function. To get around that, you need to load it as a plugin for the VideoJS player:

var player = videojs("player", {
  controls  : true
  autoplay  : false
  plugins   : {
    ads : {},
    vast: {
      url: "<vast url>",
      skip: -1
    }
  });

This way, it sets up the ads plugin and the vast plugin (which is dependent on ads) properly.

@nafisakanwal
Copy link
Author

@Manbearpixel
after the ad finishes , it does not resuming my vidoe , please help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants