Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preroll not starting when following simple exemple #509

Open
morgantmsn opened this issue Feb 3, 2020 · 0 comments
Open

Preroll not starting when following simple exemple #509

morgantmsn opened this issue Feb 3, 2020 · 0 comments

Comments

@morgantmsn
Copy link

morgantmsn commented Feb 3, 2020

Description

When implementing a simple preroll the user have to click 2 times in order for the video preroll to start.
I basically followed the steps on

http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html

Steps to Reproduce

Here is my code

options.src is https url to an mp4 video

I tried to manually call player.play() but the video didn't start then I wrapped the player.play() call in setTimeout with a 0 timeout hoping that this will push the call at the end of the stack and will work but it didn't.
Finally I wrapped the call to player.play() with a 100ms timeout and this works, but I don't think that this will solve my issue in any cases. (Commented part on the code)

 player.ads();
 
player.on("contentchanged", function () {
        player.trigger("adsready");
});

player.one("readyforpreroll", function () {
        player.ads.startLinearAdMode(); // create snapshot of the source
        player.src(options.src);
        //  player.play(); don't work either
        // setTimeout(function () {
        //     player.play().then(function () {
        //         console.log("video started");
        //     });
        // }, 100);
        // Only fix found on on video not starting
    });

Expected Results

Expecting the preroll to play

Actual Results

I Have to click on the player again in order for the video to start

Versions

videojs-contrib-ads version: 6.6.5

Video-js version: 7.6.6

Platforms

Browsers: Firefox 73.0b10 - Version 79.0.3945.130

OS/Devices: eg. MacOS 10.15.2

@morgantmsn morgantmsn changed the title Video not starting when following simple exemple Preroll not starting when following simple exemple Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant