videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.11k stars 7.46k forks source link

Streaming HLS with custom video-js tag causes constant pause on other native players on android #8403

Open minheinkhantatwork opened 1 year ago

minheinkhantatwork commented 1 year ago

Description

While I am live streaming and quit the browser using the HOME key and play a video on any other native app on android, the video is being pause constantly in 2 to 5 seconds period. It happens only with video-js tag and hls streaming. I tested using video tag with hls streaming and video-js tag with mp4. They didn't cause the pause.

Reduced test case

https://codepen.io/minhienkhant-atwork/pen/OJaKeMG

Steps to reproduce

  1. Visit to https://codepen.io/minhienkhant-atwork/pen/OJaKeMG
  2. Play the video
  3. Leave with HOME button
  4. Open a video player, eg. MX Player
  5. Play a video
  6. After a few seconds it will be paused

Errors

No response

What version of Video.js are you using?

v8.3.0

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

Chrome 115

What OS(es) and version(s) does this occur with?

Android 9

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

avadhesh18 commented 1 year ago

I have the same issue. Did you get anywhere? heck! It even freezes youtube. I am using videojs inside a webview and pressing the home button means you can't play any video on any app for more than 2-3 seconds, including the videojs video.

avadhesh18 commented 1 year ago

Ok I did some digging and found this https://github.com/video-dev/hls.js/issues/5306 I tried using different HLS libraries, none of them solved the issue. If your video keeps playing in the background and you leave the app or the browser you are playing the video in, it will cause this issue.

Since I am using webview in my app I traced the back button behaviour and paused, removed source and destroyed the video player before leaving the app. That seemed to solve the issue. However there are several ways an app can be sent to background in android tvs like pressing the assistant button and asking for another app, home button, settings button etc.

Also remember that once this bug starts, you can't stop it. the video will keep playing in the background(?) and won't stop until you soft reset the device. It's stupid and google doesn't seem to be fixing it. https://bugs.chromium.org/p/chromium/issues/detail?id=1432833