Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.12k stars 1.68k forks source link

Error: "fragments is undefined" if SegmentTimeline inside SegmentList is empty #3513

Closed tonysepia closed 3 years ago

tonysepia commented 3 years ago
Environment
Steps to reproduce

Go to https://reference.dashif.org/dash.js/v3.2.0/samples/dash-if-reference-player/index.html Paste https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.mpd into the stream selector and attempt playback

Observed behavior

Playback doesn't start

Console output
[12461][MediaPlayer] Streaming Initialized Debug.js:169:25
[12463][EventController] Start Event Controller Debug.js:169:25
[12465][MediaPlayer] Playback Initialized Debug.js:169:25
[12573][DashParser] Parsing complete: ( xml2json: 7.00ms, objectiron: 0.00ms, total: 0.00700s) Debug.js:169:25
[12575][StreamController] Matching default timing source protocol to manifest protocol:  https://time.akamai.com/?iso&ms Debug.js:169:25
[12577][ManifestUpdater] Manifest has been refreshed at Tue Jan 12 2021 21:08:17 GMT+0000 (Greenwich Mean Time)[1610485697.455]  Debug.js:169:25
[12661][TimeSyncController] Local time: Tue Jan 12 2021 21:08:17 GMT+0000 (Greenwich Mean Time) Debug.js:169:25
[12661][TimeSyncController] Server time: Tue Jan 12 2021 21:08:18 GMT+0000 (Greenwich Mean Time) Debug.js:169:25
[12661][TimeSyncController] Server Time - Local Time (ms): 484 Debug.js:169:25
[12672][StreamController] Dynamic stream: Trying to find the correct starting period Debug.js:169:25
[12673][StreamController] Switch to stream period_id. Seektime is NaN, current playback time is null Debug.js:169:25
[12673][StreamController] Seamless period switch is set to false Debug.js:169:25
[12674][StreamController] MediaSource attached to element.  Waiting on open... Debug.js:169:25
[12675][StreamController] MediaSource is open! Debug.js:169:25
[12675][StreamController] Duration successfully set to: 6 Debug.js:169:25
[12676][EventController] Added 0 inline events Debug.js:169:25
[12679][Stream] video codec: video/mp4;codecs="avc1.4d401f" Debug.js:169:25
[12686][Stream] video codec: video/mp4;codecs="avc1.4d400b" Debug.js:169:25
[12692][Stream] audio codec: audio/mp4;codecs="mp4a.40.2" Debug.js:169:25
[12693][Stream] audio codec: audio/mp4;codecs="mp4a.40.2" 3 Debug.js:169:25
[12696][Stream] No text data. Debug.js:169:25
[12696][Stream] No fragmentedText data. Debug.js:169:25
[12696][Stream] No embeddedText data. Debug.js:169:25
[12696][Stream] No muxed data. Debug.js:169:25
[12696][Stream] No image data. Debug.js:169:25
[12696] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[12696][SourceBufferSink][video] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[12697] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[12697][SourceBufferSink][audio] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[12697][DashHandler][video] Getting the request for time : 1610485667.992 Debug.js:169:25
[12699][ScheduleController][video] Schedule Controller starts Debug.js:169:25
[12699][ScheduleController][audio] Schedule Controller starts Debug.js:169:25
[12704][AbrController] [video] stay on 0/0 (buffer: 0) Debug.js:169:25
[12704][ScheduleController][video] Quality has changed, get init request for representationid = 1 Debug.js:169:25
[12704][ScheduleController][video] isFragmentProcessingInProgress is already equal to true Debug.js:169:25
[12706][AbrController] [audio] stay on 0/0 (buffer: 0) Debug.js:169:25
[12706][ScheduleController][audio] Quality has changed, get init request for representationid = 3 Debug.js:169:25
[12706][ScheduleController][audio] isFragmentProcessingInProgress is already equal to true Debug.js:169:25
[12706][PlaybackController] Native video element event: play Debug.js:169:25
[12706][StreamController] [onPlaybackStarted] Debug.js:169:25
[12707][PlaybackController] Native video element event: waiting Debug.js:169:25
[12780][BufferController][video] Init fragment finished loading saving to video's init cache Debug.js:169:25
[12780][BufferController][video] Append Init fragment video  with representationId: 1  and quality: 0 , data size: 766 Debug.js:169:25
[12780][ScheduleController][video] OnFragmentLoadingCompleted - Url: https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.h264.704x576.1mbps.mp4 , Range:0-765 Debug.js:169:25
[12781][GapController] Starting the gap controller Debug.js:169:25
[12781][ScheduleController][video] Top quality video index has changed from undefined to 0 Debug.js:169:25
[12781][DashHandler][video] Getting the next request at index: 0 Debug.js:169:25
Uncaught TypeError: fragments is undefined
    iterateSegments TimelineSegmentsGetter.js:78
    getSegmentByIndex TimelineSegmentsGetter.js:139
    getSegmentByIndex SegmentsController.js:87
    getNextSegmentRequest DashHandler.js:324
    getFragmentRequest StreamProcessor.js:726
    findNextRequest StreamProcessor.js:498
    onMediaFragmentNeeded StreamProcessor.js:445
    trigger EventBus.js:124
    trigger EventBus.js:124
    getNextFragment ScheduleController.js:209
    schedule ScheduleController.js:223
TimelineSegmentsGetter.js:78:20
[12840][BufferController][audio] Init fragment finished loading saving to audio's init cache Debug.js:169:25
[12840][BufferController][audio] Append Init fragment audio  with representationId: 3  and quality: 0 , data size: 648 Debug.js:169:25
[12840][ScheduleController][audio] OnFragmentLoadingCompleted - Url: https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.tr0.ch0.aac.96kbps.48000hz.mp4 , Range:0-647 Debug.js:169:25
[12845][PlaybackController] Native video element event: loadedmetadata Debug.js:169:25
[12845][ScheduleController][audio] Top quality audio index has changed from undefined to 0 Debug.js:169:25
[12846][DashHandler][audio] Getting the next request at index: 0 Debug.js:169:25
Uncaught TypeError: fragments is undefined
    iterateSegments TimelineSegmentsGetter.js:78
    getSegmentByIndex TimelineSegmentsGetter.js:139
    getSegmentByIndex SegmentsController.js:87
    getNextSegmentRequest DashHandler.js:324
    getFragmentRequest StreamProcessor.js:726
    findNextRequest StreamProcessor.js:498
    onMediaFragmentNeeded StreamProcessor.js:445
    trigger EventBus.js:124
    trigger EventBus.js:124
    getNextFragment ScheduleController.js:209
    schedule ScheduleController.js:223
TimelineSegmentsGetter.js:78:20
Cannot play media. No decoders for requested formats: video/mp4;codecs="avc1.4d401f", video/mp4;codecs="avc1.4d400b", audio/mp4;codecs="mp4a.40.2", audio/mp4;codecs="mp4a.40.2", audio/mp4;codecs="mp4a.40.2", audio/mp4;codecs="mp4a.40.2", video/mp4;codecs="avc1.4d401f", audio/mp4;codecs="mp4a.40.2"
Expected behavior

I would like the playback to start: it appears to be possible to play the mp4 file linked in the manifest in standard mp4 players: https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.h264.704x576.1mbps.mp4

Thank you for your time!

alexanderadam commented 3 years ago

I'm getting the message Cannot play media. No decoders for requested formats: video/mp4 too when using Firefox and opening the video directly.

IMHO this seems to be a Firefox issue. Also it's working in other browsers thus I'm somehow sure this is not related to dash.js.

And since I'm also seeing a fragments error in your log, you might also check this documentation.

I hope this will help you.

PS: I'm not related to dash.js, I just found your issue because I'm having the same issue in Firefox. :wink:

tonysepia commented 3 years ago

@alexanderadam thank you for your feedback. I don't understand why you are saying that this is only a Firefox issue.

Open any Chrome version Go to https://reference.dashif.org/dash.js/v3.2.0/samples/dash-if-reference-player/index.html Paste https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.mpd into the stream selector and attempt playback Observed behavior: Playback doesn't start

Do you agree?

alexanderadam commented 3 years ago

With Chrome I'm getting an entirely different error and the log shows:

Access to XMLHttpRequest at 'https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.h264.704x576.1mbps.mp4' from origin 'https://reference.dashif.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Do you agree?

This means that you will have to change the Cross-origin policy and this is also pretty well documented.

I hope this helps.

tonysepia commented 3 years ago

Thanks for explaining, @alexanderadam , I think we are getting closer. Sadly, I am not getting the same error you are: image

Also, I don't see how CORS could be involved, because:

If you get a moment to spare, could you please elaborate why you think the CORS is a problem?

dsilhavy commented 3 years ago

The problem is the empty SegmentTimeline tag in the manifest:

 <SegmentTimeline>
</SegmentTimeline>

Please try removing this and check again.

tonysepia commented 3 years ago

Thank you, @dsilhavy

It gets a little bit further (now, without the tags):

[3049][MediaPlayer] Streaming Initialized Debug.js:169:25
[3051][EventController] Start Event Controller Debug.js:169:25
[3053][MediaPlayer] Playback Initialized Debug.js:169:25
[3147][DashParser] Parsing complete: ( xml2json: 3.00ms, objectiron: 1.00ms, total: 0.00400s) Debug.js:169:25
[3148][StreamController] Matching default timing source protocol to manifest protocol:  https://time.akamai.com/?iso&ms Debug.js:169:25
[3150][ManifestUpdater] Manifest has been refreshed at Tue Feb 23 2021 10:10:42 GMT+0000 (Greenwich Mean Time)[1614075042.364]  Debug.js:169:25
[3272][TimeSyncController] Local time: Tue Feb 23 2021 10:10:42 GMT+0000 (Greenwich Mean Time) Debug.js:169:25
[3272][TimeSyncController] Server time: Tue Feb 23 2021 10:10:42 GMT+0000 (Greenwich Mean Time) Debug.js:169:25
[3272][TimeSyncController] Server Time - Local Time (ms): 424 Debug.js:169:25
[3277][StreamController] Dynamic stream: Trying to find the correct starting period Debug.js:169:25
[3277][StreamController] Switch to stream period_id. Seektime is NaN, current playback time is null Debug.js:169:25
[3277][StreamController] Seamless period switch is set to false Debug.js:169:25
[3278][StreamController] MediaSource attached to element.  Waiting on open... Debug.js:169:25
[3279][StreamController] MediaSource is open! Debug.js:169:25
[3279][StreamController] Duration successfully set to: 6 Debug.js:169:25
[3279][EventController] Added 0 inline events Debug.js:169:25
[3280][Stream] video codec: video/mp4;codecs="avc1.4d401f" Debug.js:169:25
[3282][Stream] video codec: video/mp4;codecs="avc1.4d400b" Debug.js:169:25
[3287][Stream] audio codec: audio/mp4;codecs="mp4a.40.2" 2 Debug.js:169:25
[3289][Stream] audio codec: audio/mp4;codecs="mp4a.40.2" 2 Debug.js:169:25
[3291][Stream] No text data. Debug.js:169:25
[3291][Stream] No fragmentedText data. Debug.js:169:25
[3292][Stream] No embeddedText data. Debug.js:169:25
[3292][Stream] No muxed data. Debug.js:169:25
[3292][Stream] No image data. Debug.js:169:25
[3293] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[3293][SourceBufferSink][video] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[3293] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[3293][SourceBufferSink][audio] Updated append window. Set start to 0 and end to 6 Debug.js:169:25
[3294][DashHandler][video] Getting the request for time : 1614075012.8630002 Debug.js:169:25
[3296][ScheduleController][video] Schedule Controller starts Debug.js:169:25
[3296][ScheduleController][audio] Schedule Controller starts Debug.js:169:25
[3301][AbrController] [video] stay on 0/0 (buffer: 0) Debug.js:169:25
[3301][ScheduleController][video] Quality has changed, get init request for representationid = 1 Debug.js:169:25
[3301][ScheduleController][video] isFragmentProcessingInProgress is already equal to true Debug.js:169:25
[3302][AbrController] [audio] stay on 0/0 (buffer: 0) Debug.js:169:25
[3303][ScheduleController][audio] Quality has changed, get init request for representationid = 3 Debug.js:169:25
[3303][ScheduleController][audio] isFragmentProcessingInProgress is already equal to true Debug.js:169:25
[3304][PlaybackController] Native video element event: play Debug.js:169:25
[3304][StreamController] [onPlaybackStarted] Debug.js:169:25
[3304][PlaybackController] Native video element event: waiting Debug.js:169:25
[3489][BufferController][video] Init fragment finished loading saving to video's init cache Debug.js:169:25
[3489][BufferController][video] Append Init fragment video  with representationId: 1  and quality: 0 , data size: 766 Debug.js:169:25
[3490][ScheduleController][video] OnFragmentLoadingCompleted - Url: https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.h264.704x576.1mbps.mp4 , Range:0-765 Debug.js:169:25
[3490][BufferController][audio] Init fragment finished loading saving to audio's init cache Debug.js:169:25
[3490][BufferController][audio] Append Init fragment audio  with representationId: 3  and quality: 0 , data size: 648 Debug.js:169:25
[3490][ScheduleController][audio] OnFragmentLoadingCompleted - Url: https://testmpdfiles.s3.eu-west-2.amazonaws.com/000000A.tr0.ch0.aac.96kbps.48000hz.mp4 , Range:0-647 Debug.js:169:25
[3492][GapController] Starting the gap controller Debug.js:169:25
[3493][PlaybackController] Native video element event: loadedmetadata Debug.js:169:25
[3493][ScheduleController][video] Top quality video index has changed from undefined to 0 Debug.js:169:25
[3494][DashHandler][video] Getting the next request at index: 0 Debug.js:169:25
Uncaught TypeError: list.SegmentURL_asArray is undefined
    getSegmentByIndex ListSegmentsGetter.js:58
    getSegmentByIndex SegmentsController.js:87
    getNextSegmentRequest DashHandler.js:324
    getFragmentRequest StreamProcessor.js:726
    findNextRequest StreamProcessor.js:498
dsilhavy commented 3 years ago

Your SegmentList contains no segments as well. I expect something went wrong with the packaging of your content.

tonysepia commented 3 years ago

Thanks @dsilhavy Do you think a change to the DASH-IF Conformance Tool (or the specification behind it) needs to be made? Who's in the wrong here - the spec or the player?