shaka-project / shaka-player

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

Stream halts when transition from dynamic to static #3567

Closed OrenMe closed 1 year ago

OrenMe commented 3 years ago

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

What version of Shaka Player are you using? 3.0.13 and 3.2.0

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

Can you reproduce the issue with the latest code from master? NA

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

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

What browser and OS are you using? Chrome on Mac

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

What are the manifest and license server URIs?

I can't share the manifest url because nature of issue is dynamic, here is sample of dynamic manifest and static manifest where transition between dynamic to static causes the issue:

Dynamic manifest ``` //removed some lines here to reduce length... ```
Static manifest ``` //removed some lines here to reduce length... ```

What configuration are you using? What is the output of player.getConfiguration()?

default config, didn't change anything

What did you do?

play a live dynamic manifest seek to start of sliding window wait till it turns to static

What did you expect to happen? because I seek back then when manifest turned from dynamic to static I expect playback to continue until the end of the remaining duration of playback

What actually happened?

The playback stops immediately when manifest turn from dynamic to static A warning appears in the console There is a gap/overlap between Periods image

See manifest data for transition between dynamic to static in section above. The expectation is that it will behave like HLS event playlist where a user can watch a live event, seek back to the beginning and view it, in the meanwhile the even is over and level playlist gets appended with EXT-X-ENDLIST but playback keeps going cause user is in DVR part of the stream and only when it reaches the last segment playback stops like a VOD stream.

This is related to another issue that I asked in #3376

Maybe we need to apply same fix here that the reference duration will be taken from either maxSegmentEndTime_ and if not applicable then duration_ or just reset reference givenDuration to some value when manifest transitions from dynamic to static in DashParser.parsePeriods_?

OrenMe commented 3 years ago

@joeyparrish any chance someone can look into this, I can provide more details if required

OrenMe commented 3 years ago

Can anyone review this and help?

OrenMe commented 3 years ago

Hi, any chance for someone to take a look?

OrenMe commented 3 years ago

@joeyparrish can you please check this issue? I previously sent a test stream over email but I guess it is invalid now, I can provide another one if needed

TheModMaker commented 3 years ago

The problem is that the segments in the manifest change times with the manifest update. In the dynamic manifest, the segments have segment times near 10,000,000 seconds; but in the static manifest, they are shifted back to 0. Changing segment times in an update isn't supported. According to #3376, you should set the Period@start attribute of the first Period to adjust the first segment to appear at the same time as it did before.

OrenMe commented 3 years ago

Thanks @TheModMaker, the linked ticket was the first issue we encountered and you can see I commented there as well. This fix actually solved the issue with loading the generated manifest after it transitioned from dynamic to static, but I missed the other part about changing the segments timing. I'll check that with the stream provider.

joeyparrish commented 2 years ago

@OrenMe, please accept our apologies for taking so long to respond to this issue the first time. We are working on our issue-handling process and tools to try to improve our response times.

To follow up on your previous comment, have you had a chance to check with the stream provider?

OrenMe commented 2 years ago

Hi @joeyparrish, I'm sure you are extremely busy so appreciate that. I'm still waiting on a response from the vendor and will update as soon as I get an answer.

OrenMe commented 2 years ago

Hi @joeyparrish , sorry it took so long, so this an AWS stream and according to the team they are spec compliant and shared some more details that seem to indicate I ned to manage this in the player side. I tried to test it in dash.if reference player and some additional ones not using shaka and it seems to handle it correctly, but I still don't know what is the issue.Would you be able to test this on your side as well if I'll share a test stream? I will share an email with a test stream which is available for you to try.

In addition, the stream I'm testing fails on latest version of the player, it works on 3.2.0, but not on 3.2.1 and also on 3.1.2 but not on 3.1.3 so it is possibly something in latest version, my initial suspicion is with this fix 'Fix tracking of active variant track in live streams'

OrenMe commented 2 years ago

@joeyparrish does this help? were you able to review the email and test with the test link? I read a bit more and asked around in video-dev on it and stumbled on a link to discussion in exoplayer https://github.com/google/ExoPlayer/issues/4780 around that matter that led to another one in dash-if https://github.com/Dash-Industry-Forum/Guidelines-TimingModel/issues/31 but I'm still don't know if this also relates to how shaka handles this

OrenMe commented 2 years ago

Hi @joeyparrish did you get a chance to review the details and test stream sent over the email?

caridley commented 2 years ago

We are also having problems when a cloud DVR stream transitions from dynamic to static during playback. We have reproduced our problem with Shaka 3.1.2 and 3.2.1. Our problem does not occur with Shaka 2.5.22

OrenMe commented 2 years ago

thanks for the feedback @caridley , @joeyparrish any chance to get this checked?

rhyswilliamsza commented 2 years ago

I have also experienced this issue on my Chromecast receivers since the SDK was updated to use Shaka v3.0.13. My streams are generated by FFMPEG, and move from dynamic to static once encoding has been completed.

I think this may have been caused by #3567 or #3419, though I'm totally guessing here. Everything worked fine on v3.0.10. Haven't checked versions in between, but I'll do a few tests and get back to you asap!

OrenMe commented 2 years ago

@joeyparrish would appreciate your feedback here, not sure where to even start looking

OrenMe commented 2 years ago

@joeyparrish any update?

caridley commented 2 years ago

@OrenMe Our specific problem with dynamic to static transitions has been fixed with the fix for https://github.com/google/shaka-player/issues/3675 in the 3.0.15, 3.1.4 and 3.2.2 releases

OrenMe commented 2 years ago

Thanks @caridley ! Will check it as soon as I'm back in the office.

yairans commented 2 years ago

The issue still exists on 3.3.0 version. @joeyparrish can you please check this issue?

glhvta commented 2 years ago

We faced the same issue when transition from 'dynamic' to 'static' content happens on Chromecast app (shaka version 3.0.13) and Web app with shaka (shaka version 3.2.1).

Could please someone share the latest status of this issue?

Thanks.

joeyparrish commented 2 years ago

Is the issue still present in the latest releases? (v3.2.10, v3.3.8, v4.0.4, v4.1.2)

glhvta commented 2 years ago

Hi @joeyparrish. I just checked behavior on the latest shaka release 3.2.10 and it looks like the issue is not reproduced.

On the same stream when switching from dynamic to static:

  • v3.2.1 stream halts
  • v3.2.10 stream continues to play till the end of asset
SivanA-Kaltura commented 1 year ago

Hello @joeyparrish. To update about the current state of the issue, our customer is using a set of manifests that transition from dynamic to static. I can't provide a working example currently, but these are examples of the enclosing mpd elements:

<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="dynamic" publishTime="2022-11-08T08:08:18" minimumUpdatePeriod="PT4S" availabilityStartTime="2021-04-15T12:42:29.396000+00:00" minBufferTime="PT12S" suggestedPresentationDelay="PT20.000S" timeShiftBufferDepth="PT544.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011">

<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="static" mediaPresentationDuration="PT1324.000S" minBufferTime="PT12S" profiles="urn:mpeg:dash:profile:isoff-main:2011">

Shaka doesn't automatically set currentTime after the transition, which causes playback to immediately end, regardless of the currentTime position before the switch. In addition it looks like seeking after the switch is made can cause a stall, possibly similar to https://github.com/shaka-project/shaka-player/issues/3902 or https://github.com/shaka-project/shaka-player/issues/2581.

A solution of saving [shaka.seekRange.end - video.currentTime] and using it to set currentTime after the transition (using responseFilter handler) works pretty well on versions 3.3.0 to 3.3.2, however from version 3.3.3 and onwards (probably because of the fix in https://github.com/shaka-project/shaka-player/commit/11f998d97254a1b9ca27b2a461bf850db2c76eaa), calling shaka.seekRange.end in the response filter handler now returns the seekRange for the STATIC manifest, which means we can't set the currentTime correctly anymore.

My question is - is the problem with setting the currentTime caused by an issue on the manifest side, on Shaka side, or on our side ? The simplest fix would probably be for us to save the value of seekRange.end at a point before it changes, if that's possible.

Thanks, Sivan

joeyparrish commented 1 year ago

If the presentation timeline changes on transition, we can't support that. For example, if segment 12 has presentation time 48300 before the transition, but presentation time 500 after the transition, you've just broken the timeline, and everything Shaka has already buffered now disagrees with the manifest.

If the timeline is stable when transitioning from dynamic to static, it should work. If it doesn't, it's a bug in the player.

Since in https://github.com/shaka-project/shaka-player/issues/3567#issuecomment-1205104829, @glhvta confirmed that the original issue was fixed in v3.2.10, I think this issue should be closed. @SivanA-Kaltura, if your content timeline is stable as I described, please open a new issue and follow all the instructions in the issue template (including content links so that we can reproduce the issue). Thanks!