shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.2k stars 1.34k forks source link

HLS (m3u8) out of sync #7139

Closed roberto-sartori-gl closed 2 months ago

roberto-sartori-gl commented 3 months ago

Have you read the FAQ and checked for duplicate open issues? Yes

If the problem is related to FairPlay, have you read the tutorial? Not related to FairPlay.

What version of Shaka Player are you using? 4.10.9 (the demo website shows the issue)

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Tried both.

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? Tested on Chrome/Chromium/Firefox on Windows and Linux.

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs? An example (note that this is hosted by bitmovin and sometimes the URL doesn't work or the download speed is very low): https://cdn.bitmovin.com/content/assets/sintel/hls/playlist.m3u8

What configuration are you using? What is the output of player.getConfiguration()? The issue is present in the demo: https://shaka-player-demo.appspot.com/demo/#audiolang=en-US;textlang=en-US;uilang=en-US;asset=https://cdn.bitmovin.com/content/assets/sintel/hls/playlist.m3u8;panel=CUSTOM%20CONTENT;build=uncompiled

With subtitles enabled, it is possible to see that they don't match the audio (subtitles seem correct).

What did you do? I just opened the demo link.

What did you expect to happen? Video and audio should be synced.

What actually happened? Video and audio are not in sync.

Are you planning send a PR to fix it? I don't have a fix :)

Note: with other players, the issue is not present. I tested the JWPlayer demo and audio and video are in sync.

avelad commented 3 months ago

It seems that the manifest you share is using EXTINF with rounding instead of using a precise time, which causes this error that you report. You would have to fix that for it to work correctly.

Attached the mediastreamvalidator report:

validation_data.html.zip

roberto-sartori-gl commented 3 months ago

Thanks for checking this.

I don't have control on that manifest (like I said, it is hosted by Bitmovin) and it was just an example. I have a lot more of these manifests which are geoblocked so I can't really easily share them but they have the same issue.

I double checked and yes, the TARGETDURATION seems to be wrong indeed (2s while the segments are like 1.96s).

While I understand that it may be a 'not properly generated manifest', it works with basically any other player I tested (it works with Bitmovin, it works with JWPlayer, to make names, or it works with 'offline players' like Kodi) so I guess there are ways to overcome this without contacting all the manifest providers and ask them to fix it :) Which, as you can imagine, may be even impossible in some cases.

I can of course implement some hack-ish methods from my side to download the first segment and check the actual duration, and edit the manifest on-the-fly, but I think it would be better to have it working out of the box with Shaka.

Thank you again for your support.

avelad commented 3 months ago

I'll let @joeyparrish decide what should be done.

joeyparrish commented 2 months ago

While I understand that it may be a 'not properly generated manifest', it works with basically any other player I tested (it works with Bitmovin, it works with JWPlayer, to make names, or it works with 'offline players' like Kodi) so I guess there are ways to overcome this without contacting all the manifest providers and ask them to fix it :) Which, as you can imagine, may be even impossible in some cases.

While this should surely be fixable, we don't have the time to fix it right now. As a policy, to help us allocate our limited time, we don't go out of our way to support non-standard content.

If you or somebody else wants to fix this, we welcome your PRs, especially if the fix doesn't introduce risk or complexity to our support of standards-compliant content.

Thanks!

shaka-bot commented 2 months ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.