matvp91 / indigo-player

Highly extensible, modern, JavaScript video player. Handles MPEG-Dash / HLS / MPEG-4 and is built on top of the HTML5 video element.
https://matvp91.github.io/indigo-player/
Apache License 2.0
1.25k stars 66 forks source link

Autoplay even if autoplay is set to false #104

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the bug When calculating the property canAutoplay of env, the can-autoplay library from https://github.com/matvp91/indigo-player/blob/7749c063194a31818aeb92f88844d97248b77bf8/src/utils/getEnv.ts#L4 starts the player in function startPlayback, even if config.autoplay is set to false. The reason is, getEnv is run on init and starts the video player.

This leads to unexpected video playback and throws an error in Safari, where Safari blocks autoplay.

To Reproduce Steps to reproduce the behavior:

  1. Clone master branch
  2. Set autoplay to false
  3. Put console.logs in can-autoplay library

Expected behavior Ultimately, .init should not playback video if autoplay is set to false. In calculating getEnv object, can-autoplay should not playback the video.

Screenshots image

Desktop (please complete the following information):