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

Post roll leaves player in a stuck state #543

Open
SUPERNOVI opened this issue Feb 13, 2023 · 3 comments
Open

Post roll leaves player in a stuck state #543

SUPERNOVI opened this issue Feb 13, 2023 · 3 comments

Comments

@SUPERNOVI
Copy link

SUPERNOVI commented Feb 13, 2023

When the post roll video ends, the video player is in an odd state. A user has to click on the video player which then triggers an ended event and also makes the video JS player display the expected control bar and replay video button on the far left.

What I'm expecting is for the post roll to end it to back to the player in its ended state as it does if there is no post roll. Currently the ended event is not fired until a user clicks but at this point I want to track that a visitor has played the video, relying on a user to click the player means I can't do this.

Here is my code where var pre_roll and post_roll are video URLs

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

    player.on('readyforpreroll', function() {
      // addVideoTracking('Single workflow', 'inspection_video', jid);
      if(pre_roll){
        // - Set pre video if it exists
        player.ads.startLinearAdMode();
        player.src(pre_roll);
        player.one('adplaying', function() {
          player.trigger('ads-ad-started');
        });
        player.one('adended', function() {
          player.ads.endLinearAdMode();
          pre_roll_played = true;
          console.log('Pre has ended!');
        });
      }else{
        // - We skip over pre
        player.ads.startLinearAdMode();
        player.ads.endLinearAdMode();
      }
    });

    player.on('readyforpostroll', function() {
      if(post_roll){
        // - Set post video if it exists
        player.ads.startLinearAdMode();
        player.src(post_roll);
        player.one('adplaying', function() {
          player.trigger('ads-ad-started');
        });
        player.one('adended', function() {
          player.ads.endLinearAdMode();
          post_roll_played = true;
          console.log('Post has ended!');
        });
      }else{
        // - We skip over post
        player.ads.startLinearAdMode();
        player.ads.endLinearAdMode();
      }
    });

I'm using video JS 7.11.4 and contrib ads 6.9.0
It's worth mentioning that the reason I am not using version 7 is because it does not work at all, I think this is a completely bugged release it completely fails to even init.

I don't believe this is a browser specific bug either as I have seen the same behaviour across browsers.

I hope I have provided enough detail. I believe my use case is very simple and easily reproducible.

@SspencerD
Copy link

I have the same problems but at the moment of starting a mid-roll

@alex-barstow
Copy link
Contributor

the reason I am not using version 7 is because it does not work at all

Version 7.x of this plugin depends on Video.js 8.x, and will not work with Video.js 7.11.4. We should have called out the removal of deprecated features more explicitly as a breaking change in the 7.0.0 Changelog. Sorry for the confusion.

If it is an option, I recommend trying Video.js 8 + contrib-ads 7 to see if that addresses your issue. I'll see if I can reproduce the issue you are having, but any fix would likely end up in contrib-ads 7 and probably wouldn't be back-ported to 6.x.

@AsbDaryaee
Copy link

Hey guys, I have the same problem here, I'm trying to play a pre-roll before the main video (I send .m3u8 file and stream it to the client), and the player sticks in the loading state without playing the main video; pre-roll plays fine though!

   "video.js": "^8.6.1"
   "videojs-contrib-ads": "^7.3.5"

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

No branches or pull requests

4 participants