AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://OvenMediaEngine.com/ovenplayer
MIT License
498 stars 124 forks source link

Muted stream falls behind in background tab #346

Closed naanlizard closed 5 months ago

naanlizard commented 1 year ago

With ovenplayer, load a stream that has DVR content in the latest Chrome (I am testing on MacOS llHLS, but I don't believe it's OS or DVR-type specific)

Mute the stream, then switch tabs

Return several minutes later and you will see that the DVR seekbar is no longer at the live position.

I assume this is something google has changed in chrome recently, as it has been doing this nearly all year even with other players.

Is there any sort of workaround with ovenplayer?

SangwonOh commented 1 year ago

@naanlizard Hi. Maybe it's because of Chrome's new performance settings. OvenPlayer has no plans to fix this issue yet. https://support.google.com/chrome/answer/12929150?visit_id=638180167360762320-1522117967&p=chrome_memory_saver&rd=1#memory_saver&zippy=%2Cturn-memory-saver-on-or-off

naanlizard commented 1 year ago

I do not have memory saver enabled, so I don't think it is that.

naanlizard commented 1 year ago

I did some reading and I don't know what the problem is still, but this article may be relevant. Again, I have memory saver disabled, so it shouldn't be pausing background videos.

But this chrome feature may be useful chrome://discards/

https://arstechnica.com/gadgets/2023/02/chrome-110-will-automatically-discard-background-tabs-heres-how-to-stop-it/

This is horrible UX for people watching streams on our website so we are urgently looking for workarounds.

naanlizard commented 1 year ago

Another comment sorry, but this looks useful for debugging, just trying to collect all the info I can find since nobody else seems to be working on it anywhere that I can find

chrome://media-internals/ - you can check if the player is paused or whatever in the background

I've opened a bug report with the chromium bug tracker to see what they have to say about it https://bugs.chromium.org/p/chromium/issues/detail?id=1441430

naanlizard commented 1 year ago

Lastly, I will note that theoplayer doesn't have this issue - I'm unsure why, but you can test here. Perhaps what they do is something that can be copied?

https://www.theoplayer.com/test-your-stream-hls-dash-hesp

getroot commented 1 year ago

As I wrote in another discussion, this is because hls.js buffers segments, and that's what they intended. Let's see if hls.js has other options. @SangwonOh

SangwonOh commented 1 year ago

@naanlizard Hi. It seems that it can be solved by using one of the options of hls js, liveMaxLatencyDurationCount or liveMax LatencyDuration. (https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlsmaxlatency)

This is demo stream which liveMaxLatencyDuration is set to 3 seconds. https://demo.ovenplayer.com/#%7B%22playerOption%22%3A%7B%22autoStart%22%3Atrue%2C%22autoFallback%22%3Atrue%2C%22mute%22%3Afalse%2C%22sources%22%3A%5B%7B%22type%22%3A%22hls%22%2C%22file%22%3A%22https%3A%2F%2Fllhls-demo.ovenmediaengine.com%2Fapp%2Fstream%2Fllhls.m3u8%22%7D%5D%2C%22hlsConfig%22%3A%7B%22liveSyncDuration%22%3A1.5%2C%22liveMaxLatencyDuration%22%3A3%2C%22maxLiveSyncPlaybackRate%22%3A1.5%7D%7D%2C%22demoOption%22%3A%7B%22autoReload%22%3Atrue%2C%22autoReloadInterval%22%3A2000%7D%7D

SangwonOh commented 5 months ago

We are closing the issue due to a long period of inactivity. If further discussion is needed, please reopen the issue.