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.16k stars 1.68k forks source link

`playbackEnded` not fired on set top box #4404

Open bitboxer opened 8 months ago

bitboxer commented 8 months ago
Environment
Steps to reproduce
  1. We used this example code: https://gist.github.com/bitboxer/ac86da9e80e57efaa338739f1ae373de
  2. Open the page on a set top box of a big telecommunication provider
  3. Wait till the video is at the end.
Observed behavior

As seen in the log output, the playbackEnded is never fired, instead you see that the GapController tries to seek to a position close to the end and then tries to play from there. Somehow this set top box does not like that.

Console output
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackTimeUpdated
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackProgress
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackTimeUpdated
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackProgress
4at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackTimeUpdated
[25913][PlaybackController] Native video element event: waiting 
at https://cdn.dashjs.org/latest/dash.all.min.js [27178][GapController] Jumping to end of stream because of gap from 634.197311 to 634.566. Gap duration: 0.3686890000000176 
at https://cdn.dashjs.org/latest/dash.all.min.js [27180][PlaybackController] Requesting seek to time: 634.566 
[27182][PlaybackController] Seeking to: 634.566 
at https://cdn.dashjs.org/latest/dash.all.min.js [27188][Stream] onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED 
at https://cdn.dashjs.org/latest/dash.all.min.js [27190][StreamController] Stream with id defaultId_0 finished buffering 
at https://cdn.dashjs.org/latest/dash.all.min.js [27190][StreamController] [onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController. 
at https://cdn.dashjs.org/latest/dash.all.min.js [27191][FragmentModel][audio] abort requests 
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackSeeking
at https://tunnel4.player-dev.tvnow.de/?CH=1 {seekTime: 634.566, streamId: 'defaultId_0', type: 'playbackSeeking'}
at https://cdn.dashjs.org/latest/dash.all.min.js [27199][BufferController][audio] audio: Removing buffer from: 609.621333 to 614.566 
at https://cdn.dashjs.org/latest/dash.all.min.js [27219][BufferController][audio] onRemoved buffer from: 609.621333 to 614.566 
at https://cdn.dashjs.org/latest/dash.all.min.js [27221][BufferController][audio] Buffered range: 614.570666 - 634.35475, currentTime =  634.566 
at https://cdn.dashjs.org/latest/dash.all.min.js [27224][BufferController][audio] Waiting for more buffer before starting playback 
at https://cdn.dashjs.org/latest/dash.all.min.js [27227][SourceBufferSink][audio] Updated append window for audio. Set start to 0 and end to 634.576 
[27237][ScheduleController][audio] Quality has changed, get init request for representationid = bbb_a64k 
at https://cdn.dashjs.org/latest/dash.all.min.js [27265][StreamProcessor][audio] OnFragmentLoadingCompleted for stream id defaultId_0 and media type audio - Url: https://dash.akamaized.net/akamai/bbb_30fps/bbb_a64k/bbb_a64k_0.m4a  
at https://cdn.dashjs.org/latest/dash.all.min.js [27267][BufferController][audio] Append Init fragment audio  with representationId: bbb_a64k  and quality: 0 , data size: 633 
at https://cdn.dashjs.org/latest/dash.all.min.js [27273][StreamProcessor][audio] Appended bytes for audio and stream id defaultId_0 
at https://cdn.dashjs.org/latest/dash.all.min.js [27274][StreamProcessor][audio] [audio] lastInitializedRepresentationInfo changed to 0 
[27276][ScheduleController][audio] Media segment needed for audio and stream id defaultId_0 
at https://cdn.dashjs.org/latest/dash.all.min.js [27277][DashHandler][audio] Index for time 634.566 is 158 
at https://cdn.dashjs.org/latest/dash.all.min.js [27278][StreamProcessor][audio] Next fragment request url for stream id defaultId_0 and media type audio is https://dash.akamaized.net/akamai/bbb_30fps/bbb_a64k/bbb_a64k_159.m4a 
at https://cdn.dashjs.org/latest/dash.all.min.js [27298][StreamProcessor][audio] OnFragmentLoadingCompleted for stream id defaultId_0 and media type audio - Url: https://dash.akamaized.net/akamai/bbb_30fps/bbb_a64k/bbb_a64k_159.m4a  
at https://cdn.dashjs.org/latest/dash.all.min.js [27301][Stream] onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED 
at https://cdn.dashjs.org/latest/dash.all.min.js [27302][StreamController] Stream with id defaultId_0 finished buffering 
at https://cdn.dashjs.org/latest/dash.all.min.js [27303][StreamController] [onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController. 
at https://cdn.dashjs.org/latest/dash.all.min.js [27303][MediaSourceController] call to mediaSource endOfStream 
at https://cdn.dashjs.org/latest/dash.all.min.js [27304][BufferController][audio] checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id defaultId_0 and type audio 
at https://cdn.dashjs.org/latest/dash.all.min.js [27304][BufferController][audio] Buffered range: 614.570666 - 634.35475, currentTime =  634.566 
[27305][BufferController][audio] Got enough buffer to start 
at https://cdn.dashjs.org/latest/dash.all.min.js [27306][StreamProcessor][audio] Appended bytes for audio and stream id defaultId_0 
at https://tunnel4.player-dev.tvnow.de/?CH=1 DashJS playbackProgress
Expected behavior

The player fires a playbackEnded-Event.

I can help to debug this issue, but currently I am not sure what the role of the GapController is in here.

bitboxer commented 8 months ago

Sadly I cannot open the reference page because it's a set-top-box

bitboxer commented 8 months ago

@dsilhavy would love to get a hint how I could debug this or figure out a bugfix for this.

dsilhavy commented 7 months ago

It looks like the buffer is not fully filled until the very end. What values do you get when you pause playback shortly before the end and query the buffer level?

var vid = document.querySelector('video')
vid.buffered.start(0)
625.664
vid.buffered.end(0)
634.566666

For further debugging also try to disable gap jumping and check if the ended event is fired then or if the player stays in waiting state: https://cdn.dashjs.org/latest/jsdoc/module-Settings.html#~Gaps