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

Cannot read property 'suppressedTracks' of undefined on desktop browsers with HLS live stream #506

Open
Dzoge opened this issue Nov 30, 2019 · 6 comments

Comments

@Dzoge
Copy link

Dzoge commented Nov 30, 2019

Greetings!

I ran into an issue with HLS live stream not switching back to playback after the ad is finished. The following error is logged: ERROR: TypeError: Cannot read property 'suppressedTracks' of undefined referring to player.ads.snapshot object in restorePlayerSnapshot function of videojs-contrib-ads plugin.

But this happens only on my desktop browsers and does not happen on my iPhone (Safari, Chrome). Unfortunately I do not have aaccess to an Android phone at the moment.

I tested on the latest Chrome and Firefox on desktop:

  • Chrome 78.0.3904.108 (Official Build) (64-bit) [macos 10.15.1]
  • Firefox (70.0.1) [macos 10.15.1]
  • Chrome 78.0.3904.108 (Official Build) (64-bit) (cohort: Stable) [windows 10]
  • Firefox 70.0.1 (64-bit) [windows 10]

I found a similar issue #173 but that's closed and looks like this is a different case.

I am using videojsx-vast-plugin for ads with the latest versions of:

  • video.js (7.6.6 from npm)
  • videojs-contrib-ads (6.6.5 from npm)

I have setup the examples:

This is my setup:

<video-js id=vid1 width=600 height=300 class="vjs-default-skin" controls autoplay data-setup='{"autoplay":true}'>
    <source src="https://imedi-tv.cdn.xsg.ge/imedihd/index.m3u8" type="application/x-mpegURL" />
</video-js>
<div id="companion"></div>
<script>
    var player = videojs('vid1');
    player.vast({
        url: 'https://ads.imedi.ge/api/vast/?zone=137',
        skip: 5,
        companion: {
            elementId: "companion",
            maxWidth: 300,
            maxHeight: 250
        }
    });
</script>
@danshando
Copy link

@Dzoge did you ever get this figured out. I'm having what looks to be the same or similar issue:
TypeError: undefined is not an object (evaluating 'a.suppressedTracks')

The error happens when endLinearAdMode is called for me.

@Dzoge
Copy link
Author

Dzoge commented Jun 2, 2020

@Dzoge did you ever get this figured out. I'm having what looks to be the same or similar issue:
TypeError: undefined is not an object (evaluating 'a.suppressedTracks')

The error happens when endLinearAdMode is called for me.

I ended up using old version of some libraries and managed to make it work. Can’t remember the details though.

@danshando
Copy link

Okay great, thanks for the reply.

@danrossi
Copy link

danrossi commented Jul 2, 2020

I get this also. live HLS refuses to return and play back. Stuck in pending on the master playlist.

@elkhatibmsi
Copy link

elkhatibmsi commented Sep 24, 2020

Has` anyone been able to solve this? I am getting the same issue when attempting to run a preroll video before an hls stream. Here is my markup and code (Codepen eg: https://codepen.io/elkhatibmsi/pen/BaKwVVx).

FYI I am using the boilerplate provided by the videojs-contrib-ads documentation: http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html.

<script src="https://vjs.zencdn.net/7.6.0/video.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.7.0/videojs-contrib-ads.js"></script>
<link href="https://vjs.zencdn.net/7.8.4/video-js.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.3.0/videojs-contrib-ads.css" rel="stylesheet" type="text/css">

<video id="webcam" class="video-js vjs-default-skin" controls width="640" height="264">
  <source src="https://nzp-ms05.si.edu/live_edge_elephant/elephant01_all.smil/playlist.m3u8" type="application/x-mpegurl" />
</video>
<script>
videojs('webcam', {}, function(){
  var player = this;
player.ads(); // initialize videojs-contrib-ads

// request ads whenever there's new video content
player.on('contentchanged', function() {
  // in a real plugin, you might fetch new ad inventory here
  player.trigger('adsready');
});

player.on('readyforpreroll', function() {
  player.ads.startLinearAdMode();
  // play your linear ad content
  // in this example, we use a static mp4
  player.src('https://images.all-free-download.com/footage_preview/webm/dragonfly_17.webm');

  // send event when ad is playing to remove loading spinner
  player.one('adplaying', function() {
    player.trigger('ads-ad-started');
  });

  // resume content when all your linear ads have finished
  player.one('adended', function() {
    player.ads.endLinearAdMode();
  });
});
// in a real plugin, you might fetch ad inventory here
player.trigger('adsready');
});
</script>

@afief
Copy link

afief commented Aug 4, 2021

Hi everyone, I got this issue only when the main source is live stream and able to fix it by adding liveCuePoints to ads() initialization as mentioned in their documentation http://videojs.github.io/videojs-contrib-ads/integrator/options.html

player.ads({
  liveCuePoints: false
});

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

5 participants