Skip to content

Commit

Permalink
[MSS] Fix start FragmentInfo requests on seeking event (#3924)
Browse files Browse the repository at this point in the history
* [MSS] Fix start FragmentInfo requests on seeking event

* [MSS] Fix start FragmentInfo requests on seeking event
  • Loading branch information
bbert authored Apr 20, 2022
1 parent 7f67f19 commit ad1ba6c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 22 deletions.
1 change: 0 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ declare namespace dashjs {
PLAYBACK_PLAYING: 'playbackPlaying';
PLAYBACK_PROGRESS: 'playbackProgress';
PLAYBACK_RATE_CHANGED: 'playbackRateChanged';
PLAYBACK_SEEK_ASKED: 'playbackSeekAsked';
PLAYBACK_SEEKED: 'playbackSeeked';
PLAYBACK_SEEKING: 'playbackSeeking';
PLAYBACK_STALLED: 'playbackStalled';
Expand Down
6 changes: 3 additions & 3 deletions src/mss/MssHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function MssHandler(config) {
}
}

function onPlaybackSeekAsked() {
function onPlaybackSeeking() {
if (playbackController.getIsDynamic() && playbackController.getTime() !== 0) {
startFragmentInfoControllers();
}
Expand All @@ -212,7 +212,7 @@ function MssHandler(config) {
function registerEvents() {
eventBus.on(events.INIT_FRAGMENT_NEEDED, onInitFragmentNeeded, instance, { priority: dashjs.FactoryMaker.getSingletonFactoryByName(eventBus.getClassName()).EVENT_PRIORITY_HIGH }); /* jshint ignore:line */
eventBus.on(events.PLAYBACK_PAUSED, onPlaybackPaused, instance, { priority: dashjs.FactoryMaker.getSingletonFactoryByName(eventBus.getClassName()).EVENT_PRIORITY_HIGH }); /* jshint ignore:line */
eventBus.on(events.PLAYBACK_SEEK_ASKED, onPlaybackSeekAsked, instance, { priority: dashjs.FactoryMaker.getSingletonFactoryByName(eventBus.getClassName()).EVENT_PRIORITY_HIGH }); /* jshint ignore:line */
eventBus.on(events.PLAYBACK_SEEKING, onPlaybackSeeking, instance, { priority: dashjs.FactoryMaker.getSingletonFactoryByName(eventBus.getClassName()).EVENT_PRIORITY_HIGH }); /* jshint ignore:line */
eventBus.on(events.FRAGMENT_LOADING_COMPLETED, onSegmentMediaLoaded, instance, { priority: dashjs.FactoryMaker.getSingletonFactoryByName(eventBus.getClassName()).EVENT_PRIORITY_HIGH }); /* jshint ignore:line */
eventBus.on(events.TTML_TO_PARSE, onTTMLPreProcess, instance);
}
Expand All @@ -225,7 +225,7 @@ function MssHandler(config) {

eventBus.off(events.INIT_FRAGMENT_NEEDED, onInitFragmentNeeded, this);
eventBus.off(events.PLAYBACK_PAUSED, onPlaybackPaused, this);
eventBus.off(events.PLAYBACK_SEEK_ASKED, onPlaybackSeekAsked, this);
eventBus.off(events.PLAYBACK_SEEKING, onPlaybackSeeking, this);
eventBus.off(events.FRAGMENT_LOADING_COMPLETED, onSegmentMediaLoaded, this);
eventBus.off(events.TTML_TO_PARSE, onTTMLPreProcess, this);

Expand Down
6 changes: 0 additions & 6 deletions src/streaming/MediaPlayerEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,6 @@ class MediaPlayerEvents extends EventsBase {
*/
this.PLAYBACK_SEEKING = 'playbackSeeking';

/**
* Sent when a seek operation has been asked.
* @event MediaPlayerEvents#PLAYBACK_SEEK_ASKED
*/
this.PLAYBACK_SEEK_ASKED = 'playbackSeekAsked';

/**
* Sent when the video element reports stalled
* @event MediaPlayerEvents#PLAYBACK_STALLED
Expand Down
1 change: 0 additions & 1 deletion src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ function PlaybackController() {

if (!internalSeek) {
seekTarget = time;
eventBus.trigger(Events.PLAYBACK_SEEK_ASKED);
}
logger.info('Requesting seek to time: ' + time + (internalSeek ? ' (internal)' : ''));
videoModel.setCurrentTime(time, stickToBuffered);
Expand Down
11 changes: 0 additions & 11 deletions test/unit/streaming.controllers.PlaybackControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,6 @@ describe('PlaybackController', function () {
expect(videoModelMock.time).to.equal(10);
});

it('should seek and trigger Events.PLAYBACK_SEEK_ASKED event', function (done) {

let onSeekedAsked = function () {
eventBus.off(Events.PLAYBACK_SEEK_ASKED, onSeekedAsked);
done();
};
eventBus.on(Events.PLAYBACK_SEEK_ASKED, onSeekedAsked, this);

playbackController.seek(10);
});

it('should return if video is seeking', function () {
videoModelMock.isseeking = true;
expect(playbackController.isSeeking()).to.equal(videoModelMock.isseeking);
Expand Down

0 comments on commit ad1ba6c

Please sign in to comment.