MailOnline / videojs-vast-vpaid

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

player.muted(true) not working #192

Open manumohant opened 8 years ago

manumohant commented 8 years ago

Its really interesting!!!. Below is my code. player = videojs(videoEl, adPluginOpts); player.muted(true); player.play();

Its doesn't have any effect. Even pure HTML5 muted='true' also not working with "videojs-vast-vpaid". Any solutions??

indieocean commented 8 years ago

We managed to get it to work using the vast.adStart event.

player.on('vast.adStart', function(evt) { console.log('Ad Started!'); player.volume(0); });

manumohant commented 8 years ago

yeah, same thing is using here too. But the problem is the muted() method not working

sportexholdings commented 8 years ago

Hi!, do you get mute work? I have tried.but it's not work me too.. Demos are made here:

http://chative.com/ad/imesh/videetv-mute.php

http://chative.com/ad/imesh/adaptv-mute.php

also, i have add auto play function,to this.. but ads not load with auto play..how do i get ads work with auto play... any idea?

Best, Shawn

manumohant commented 8 years ago

You have to call play() method on player to start ad automatically. I don't think adding auto play to video element will do this job. And you don't need to initialize player twice.

sportexholdings commented 8 years ago

Like this: player.on('vast.adStart', function(evt) { console.log('Ad Started!'); player.play(); player.volume(0); });

is that work for you?

sportexholdings commented 8 years ago

sorry!, can you gave me exact code? if you don't mine..

manumohant commented 8 years ago

There's no meaning of calling play() inside 'adStart' event. Try calling play() just after initializing player and listeners . You can do something like this

player = videojs(videoEl, adPluginOpts); 
player.on('vast.adStart', function(evt) {
console.log('Ad Started!');
player.volume(0);
});
player.play();

Note: If player.play() is not working, try calling player.vast.adUnit.playAd()

shachr commented 7 years ago

its working only for html5 ads, the flash version doesn't work still. update: actually it is working in the flash version of 1.0.2 (but not 1.0.1)

manumohant commented 7 years ago

@shachr Check your AdTag URL here http://manumohant.github.io/ . It should support both HTML and flash(any version). Source is available here https://github.com/manumohant/video-js-vast-vpaid-no-cors . Check it out,