video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.93k stars 2.59k forks source link

A second loadSource call autoplays primary content immediately. #6839

Open matvp91 opened 6 days ago

matvp91 commented 6 days ago

What version of Hls.js are you using?

v1.6.0-beta

What browser (including version) are you using?

Chrome

What OS (including version) are you using?

macOS

Test stream

No response

Configuration

{}

Additional player setup steps

This is a regression compared to v1.5.

A sample with v1.5: https://stackblitz.com/edit/vitejs-vite-fkf2xf A sample with v1.6-beta: https://stackblitz.com/edit/vitejs-vite-tohum2

The same steps to reproduce result in different behavior, with v1.5 not starting the asset (as it requires a user gesture), but v1.6 does.

Checklist

Steps to reproduce

  1. Click "loadSource".
  2. Click "play".
  3. Click "loadSource" again, and you'll notice that playback starts immediately.

Expected behaviour

A subsequent loadSource call should not start playback when no autoplay attribute is present.

What actually happened?

A subsequent loadSource call starts playback immediately, with autoplay not present on the video element.

Console output

N/A

Chrome media internals output

No response

robwalch commented 3 days ago

Adding Interstitials label even though this is reproducible without Interstitials in the HLS asset. The running theory is that the play() calls in the Interstitial controller are responsible:

      this.resumePrimary(scheduledItem, index);
      if (this.shouldPlay) {
        this.hls.media?.play();
      }

Setting this.shouldPlay = false; on onManifestLoading may fix this.