videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
379 stars 257 forks source link

While casting to TV the player stops after the preroll #539

Closed nickopris closed 1 year ago

nickopris commented 1 year ago

Description

I am not certain this is an issue with this plugin or with the chromecast plugin - I have too many things put together to know exactly where the issue lies. So I am asking here hoping that there is someone more experienced than me.

While casting from mobile to TV the player stops after the preroll, then disconnects after a few seconds.

Steps to Reproduce

   if (typeof videojs !== "undefined") {
        options = {
          techOrder: ['chromecast', 'html5'],
          html5: {
            hls: {
              overrideNative: true
            },
            nativeAudioTracks: false,
            nativeVideoTracks: false,
          },
          muted: true
        };
        var player = videojs('#ctf-player', options);
        player.chromecast();
        var id = $(player).attr('data-session');
        var url = $(player).attr('data-source');
        var type = $(player).attr('data-type');
        var duration = $(player).attr('data-duration');
        track = $(player).attr('data-track');

        //Prerolls
        try {
          var globalAds = player.options().vpreload.split(","); //get our option in an array
        } catch(e) {
          // ignore.
        }
        if (globalAds) {
          player.ads(); // initialize videojs-contrib-ads

          // request ads whenever there's new video content
          player.on('contentchanged', function () {
            player.trigger('adsready');
          });

          player.on('readyforpreroll', function () {
            player.ads.startLinearAdMode();
            playNextAd(globalAds);
          });

          player.trigger('adsready');
        }

        if (url) {
          player.src({
            src: url,
            type: type,
          });
          player.responsive(true);
        }

      }

Below is my HTML:

<video-js id="ctf-player"
                    class="ctf-video-js vjs-fill vjs-theme-fantasy"
                    controls
                    playsinline
                    preload="auto"
                    data-source="MY HLS STREAM"
                    data-track="1"
                   vpreload="MY PREROLL HLS STREAM"
                    data-type="application/x-mpegURL"
                    data-session="1"
                    data-jump-to="0"
                    data-duration="30">
          </video-js>

I am using:

Expected Results

The video source should start playing on TV after the preroll video ended, like on a desktop browser.

Actual Results

While casting from mobile to TV the player stops after the preroll, then disconnects after a few seconds.

FTL1 commented 1 year ago

Did you ever solve this? We see similar issues with spotx ads not appending durring Pre-Roll for DASH in Chrome, e.g.:

Lots of these:

[634486][SourceBufferSink][video] getAllBufferRanges exception: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source.

r @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 getAllBufferRanges @ videojs-dash.min.js:17 getContinuousBufferTimeForTargetTime @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 Promise.then (async) (anonymous) @ videojs-dash.min.js:17 prepareInnerPeriodPlaybackSeeking @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 J @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 trigger @ videojs-dash.min.js:17 z @ videojs-dash.min.js:17 seeking (async) r @ videojs-dash.min.js:17 setCurrentTime @ videojs-dash.min.js:17 w @ videojs-dash.min.js:17 U @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17

Followed by this:

videojs-dash.min.js:17 [634486][SourceBufferSink][video] Failed to set append window

r @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 b @ videojs-dash.min.js:17 I @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 _ @ videojs-dash.min.js:17 Z @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 Promise.then (async) (anonymous) @ videojs-dash.min.js:17 prepareInnerPeriodPlaybackSeeking @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 J @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17 trigger @ videojs-dash.min.js:17 z @ videojs-dash.min.js:17 seeking (async) r @ videojs-dash.min.js:17 setCurrentTime @ videojs-dash.min.js:17 w @ videojs-dash.min.js:17 U @ videojs-dash.min.js:17 (anonymous) @ videojs-dash.min.js:17

alex-barstow commented 1 year ago

It sounds like this plugin and silvermine's Chromecast plugin (which we do not own or maintain) are incompatible, which is not surprising. In order for them to work together, the Chromecast receiver app would need specific logic that integrates with this plugin in order to support client-side ad playback.

Unfortunately, to achieve what you want will require writing a custom Chromecast receiver app.