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
15.01k stars 2.59k forks source link

redundant stream - player doesn't switch to backup v0.7.0 #993

Closed yairans closed 7 years ago

yairans commented 7 years ago
Environment

http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Fqa-apache-testing-ubu-01.dev.kaltura.com%2Fp%2F5091%2Fsp%2F509100%2FplayManifest%2FentryId%2F0_6bn91jdw%2Fformat%2Fapplehttp%2Fprotocol%2Fhttp%2FuiConfId%2F15203413%2Fa.m3u8%3Freferrer%3DaHR0cDovL3FhLWFwYWNoZS10ZXN0aW5nLXVidS0wMS5kZXYua2FsdHVyYS5jb20%3D%26playSessionId%3D9facf4c5-4acb-918e-5fce-f646e3c84edc&enableStreaming=true&autoRecoverError=true&enableWorker=true&dumpfMP4=false&levelCapping=-1&defaultAudioCodec=undefined

Steps to reproduce

Load the page. Verify there is a redundant stream in the manifest.m3u8 Play with the primary for ~1 min Drop the primary (I use clumsy 0.2)

Expected behavior

The player should play from the backup smoothly.

Actual behavior

The player does switch to the backup but doesn't download ts's from it.

media-internals.txt console-log.txt network-log.txt change to .har

mangui commented 7 years ago

Hi @yairans I built a stream as per your scenario, 1 level, with 1 failover.

xhr will fail on second fragment on master => hls.js switches to redundant xhr will fail on 6th fragment on redundant => hls.js switches back to master

image

http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Fwww.streambox.fr%2Fplaylists%2Fx36xhzz.redundant%2Fx36xhzz.m3u8&enableStreaming=true&autoRecoverError=true&enableWorker=true&dumpfMP4=false&levelCapping=-1&defaultAudioCodec=undefined

yairans commented 7 years ago

Hi @mangui There are 2 differences between my scenario and your test page:

  1. My stream is live
  2. In my stream there are 4 levels and 1 failover for each one. Maybe this can explain the difference. I did double check and it is still reproducible. (sometimes it does play from the backup but doesn't switch back to the primary like described here https://github.com/dailymotion/hls.js/issues/994)
mangui commented 7 years ago

I changed my test stream, it is now 3 levels, and 1 failover for each one. and switching primary => backup => primary works as expected. in case of live stream, it might be different ... in your logs i can see that the after retrying several times to

loading playlist for level 4
...
level controller,levelLoadError for level 4: switching to redundant stream id 1

hls.js is switching to level 0, but it gets a 404 as well on this level.

2017-02-20 10:23:16.706 logger.js:39 [log] > switching to level 0
2017-02-20 10:23:16.708 logger.js:39 [log] > loading playlist for level 0
2017-02-20 10:23:16.721 xhr-loader.js:68 GET http://il-wowza-centos-rec-03.dev.kaltura.com:8080/live/hls/p/5091/e/0_6bn91jdw/sd/10000/t/ntTGabMWISbu1BOs89m__g/index-s33.m3u8 404 (Not Found)
yairans commented 7 years ago

@mangui Why after switching to redundant stream id 1 (il-wowza-centos-rec-04) does it try to get from level 0 of redundant stream id 0 (il-wowza-centos-rec-03)?

mangui commented 7 years ago

most probably because at that point, you are in low buffer, and in that case ABR controller can eventually switch down to minimize rebuffering delay. see logic here: https://github.com/dailymotion/hls.js/blob/master/src/controller/abr-controller.js#L225-L255

you might enable logger.trace to get more clues on what is going on.

yairans commented 7 years ago

@mangui This issue isn't reproducible now, i.e the player does switch to backup and plays fine. But I still experience the #994 issue also in the latest version. You can close this issue and i'll update the #994 issue to includes the latest also.