New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safari Fragment Loop Error before DAI Discontinuity in Event Stream #1331
Comments
interesting. i can't see NaN values reported in log-safari.txt however ? |
I can give you streams to test if you need. The problem is that they are event streams, so they have a duration of 5 hours max. I can try to capture with Charles the stream and logs. Will send them as soon as I get them. |
I have a capture of the player with the issue in safari. This is the url of the player (stream alive until 17:00 uk time and geoblocked to uk): The Safari log: https://sport.voltest.bt.com/diva/DivaConf/github/safari-dai-hls-issue.txt The charles capture: https://sport.voltest.bt.com/diva/DivaConf/github/safari-dai-hls-issue.chls.zip |
Hi @mangui, We have been testing the player in different safari versions... this is the feedback we got: 10.0 (Released September 20, 2016) – DAI adverts working with no issue? 10.1.1 (Released May 15, 2017) – Player crashes on DAI ad break + does not recover. 11.0 (TBC September/October 2017) – Stutters before the advert, then player shows video error, then video plays on after ad finished. thanks! |
looks like after a discontinuity, Safari is not appending anything in the buffer although sourcebuffer.append is triggered. the only way to get help on that is to have clear repro steps so that Safari engineers could have a look |
Thanks for replying @mangui. The thing is that works fine playing the stream pasting it in the address input, and we have tested with other html5 players, and also works ok. The problem only happens with the Hls.js + Safari 10.1.* combination. Were you able to have a look to the charles trace? maybe you see something there (problem with stream or similar) that could be causing this. The only difference I saw between safari and chrome is that in safari the duration parsed for the previous segment before the discontinuity differs form the duration tag in the level playlist, in chrome duration and tag are equal. Please let me know if you need more info or if you need event streams to test I can prepare them. My skype is dailosmm. Thanks a lot. |
I have limited time to spend on analyzing tickets, this is why having a reduced test case would help. thanks |
Hi @mangui, A colleague has been able to create a small vod stream where you can easily replicate the issue: The new safari 11 release, I can see bit different behaviour... safari skips the discontinuity... is able to continue playing the main stream, but no advert is played. Thanks a lot |
switching audio sampling rate on discontinuity from 22.5 kHz to 24kHz might not help ... in the meantime you could also assess my statement by respectively disabling audio / video parsing: |
Hello @mangui any other suggestion or test I could make to help resolving the issue? Thanks a lot for your help |
then we would need help from Safari engineers to understand why source buffer append does not result in extra video being buffered. |
We have a bug on this; but it's at a media framework level, so there's no possible fix which would make it into a STP or Nightly. |
anything we could workaround at remuxing side ? |
As far as the "source buffer append does not result in extra video being buffered" issue, only append a full media segment at a time? Unfortunately, I don't have more information about the proximate cause of the issue, just that the description matches that of another bug I saw go by. |
basically just testing this link on Safari is enough to repro. video from frag 4 never gets buffered
|
Hi @jernoble and @mangui, Thanks for the help |
While searching for ways to move this thread forward, and in particular to help @mangui to develop a workaround, we found out that video.js is able to play the video just fine in Safari. If you paste the goold old video above into http://videojs.github.io/videojs-contrib-hls/ you will see that the video plays fine. Hope this helps.. |
@zuzzurro Safari supports HLS natively via the video element src URL property. I will test this myself start of next week, can't really get to it right now. What I can say now is: If videojs-contrib-hls can play it in "MediaSource mode" ( If only the native Safari client can play it, and it fails in videojs-contrib-hls when using Either way, you can then fall-back to native Safari HLS to play this content (no need to use videojs either, just use the native video DOM element and set the URL as src) - but this has disadvantages against using Hls.js of course. Get in touch with me via email for further investigation :) |
it is indeed working with http://videojs.github.io/videojs-contrib-hls/ which uses transmuxing as well. |
Just for reference, here is a quite recent videojs-contrib-hls build (5.12.0) + video.js 6.x, that is configured to use MediaSource (overrideNative:true, nativeAudio/VideoTracks: false): http://tchakabam.com/test/2coders-videojs/ It has the above URL set by default: http://2coders.com/streamtest/manifest.m3u8 In the console should appear logs that indicate that the videojs-hls client is actually running, as opposed to the built-in Safari one. |
IMPORTANT: You need to click on "load" button so that the videojs engine loads with the desired options actually. If you just click on play immediately, will use built-in HLS. Not sure yet if this is intended, related to how the test-page is built, or if that is actually a bug in videojs/hls (at least this problem of not loading the engine on page load only appears on Safari, so its probably also browser related :D) |
Do you also get these nasty artifacts in there @mangui ? It seems there are still issues there compared to the built-in quicktime component ;) at least that's what I see on my macBook. but may be hw or OS version related again. I m testing on Safari 10.1. |
@mangui said:
Well, one thing I can see immediately from the generated fMP4s is that most of the samples overlap with previous samples. When parsing the movie and sorting the output by PTS, you get something like the following:
I don't really understand why that's happening; it's pretty obvious that those samples have explicit durations of 0.04 (3600/90000) set in the I tried to dump the video fMP4, but it doesn't seem to dump the generated fMP4 past 00:36.28, and all of those samples are accounted for in the generated media. Any hints? |
Yeah, I think the samples you append are getting dropped because the trackID changes across the two initialization segments (which is totally legal, so long as there is only one video track). This sounds like a simple bug in WebKit's MSE append algorithm. |
indeed it seems that track id is the video PID (from TS) ... |
That should be a sufficient workaround; I'll file a WebKit bug to track the work that should make this workaround unnecessary. |
So it looks like we have been hit twice by the same Safari issue as in #1272 .. Right? |
Ok so it should just be about making sure that we keep the track ID for video consistent. At any time, there can only be one video sourcebuffer always (no browser supports several) anyway. Therefore, there should be no reason really in dragging the track-ID from TS Program ID into the MP4, since we may get TS from many different sources into our HLS stream, this can be inconsistent, and cause such issues. Since we are having fixed numbers of tracks per type on the MSE SourceBuffer side (one video, one audio, one text, one ID3), and we are just remuxing all the different "tracks" or renditions or whatever pops up in TS into the one type of MP4, we can as well just have a fixed track ID in the muxed MP4. I will push the necessary changes on TSdemuxer/remuxer interface so we are simply fixing the track IDs of the resulting MP4 tkhd boxes. |
I've tested in our environment and this fix is working 👍 |
This is really helpful for me to fix issue while switch to another audio |
Environment
The stream is an event stream from 12:30 to 17:00 uk time (stream is geoblocked in UK... need to use VPN to be able to play it... I can provide more event streams in other time span if needed)
https://sport.voltest.bt.com/diva/DivaConf/github/index.html?src=https%3A%2F%2Ft1-btsport-live-hls-test-cluster-c.akamaized.net%2Fout%2Fu%2Fdiva_bts2%2FAUTO170906AT1230TO1700.m3u8%3Fbt.mode%3Dlive_event%26bt.channel%3Dl2v-diva_bts2%26bt.event%3DAUTO170906AT1230TO1700%26yo.ac%3Dtrue%26yo.ep%3Dtrue%26yo.up%3Dhttps%253A%252F%252Ft1-btsport-live-hls-test-cluster-c.akamaized.net%252Fout%252Fu%252Fdiva_bts2%252F%26yospace.initurl%3Dhttps%253A%252F%252Fcsm-e-cebteurxaws416-2hjvnjz85og7.tls1.yospace.com%252Fcsm%252Fextevent.AUTO170906AT1230TO1700%252Fbtsport01%252Cl2v-diva_bts2.m3u8%26bt.yosecure%3Dtrue%26yo.ch%3Dtrue%26hdnea%3Dst%3D1504665008~exp%3D1504717200~acl%3D%252Fout%252Fu%252Fdiva_bts2%252F%252A~hmac%3Db996a8e250c7bfcf18b837a8c8d7de2ecbcac1f90bca15895fba7917b42a4378&enableStreaming=true&autoRecoverError=true&enableWorker=true&dumpfMP4=false&levelCapping=-1&defaultAudioCodec=undefined
Steps to reproduce
The event stream has dynamic adverts inserted every 7 mins aprox. The adverts have #EXT-X-DISCONTINUITY tags. "Frag Loop Loading Error" is thrown in Safari
Expected behavior
The adverts should play smoothly.
Actual behavior
In Chrome, FireFox and IE the advert plays as expected when the discontinuity is reached, but in safari we get this error: "Frag Loop Loading Error” and the player freezes in the previous fragment. Then we see that safari loads the to first segments of the ad, but in the log we see that the player is not able to buffer the segment 794 (the first segment of the advert). In Chrome we don’t get this error and we see buffer growing after discontinuity.
If we play the stream in safari directly putting the stream in the address input, the adverts are played correctly.
There is a screenshot attached of what we see in safari. When reaching the discontinuity… after loading the 2 first segments of the ad, the player starts switching between level 5 and 6 playlists but no segments are loaded.
Debugging the session I see some differences in the
fragment duration parsed in safari and the passed in the INF tag, while in chrome the fragment duration and the tag is the same. (Also attached screenshots)
log-chrome.txt
log-safari.txt
Console output
The text was updated successfully, but these errors were encountered: