Skip to content

Commit

Permalink
fixed liveSeek on manifest update
Browse files Browse the repository at this point in the history
  • Loading branch information
gitperonam committed Apr 16, 2019
1 parent 65ddb6a commit fe73c78
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contrib/akamai/controlbar/ControlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
if (!seeking) {
setTime(displayUTCTimeCodes ? player.timeAsUTC() : player.time());
if (seekbarPlay) {
if (player.duration() - player.time() < liveThresholdSecs) {
if (player.isDynamic() && (player.duration() - player.time() < liveThresholdSecs)) {
seekbarPlay.style.width = '100%';
} else {
seekbarPlay.style.width = (player.time() / player.duration() * 100) + '%';
Expand Down Expand Up @@ -495,14 +495,16 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
}
};

var onStreamInitialized = function (/*e*/) {
var onSourceInitialized = function () {
startedPlaying = false;
};

var onStreamInitialized = function (/*e*/) {
updateDuration();
var contentFunc;
//Bitrate Menu
if (bitrateListBtn) {
destroyBitrateMenu();

var availableBitrates = { menuType: 'bitrate' };
availableBitrates.audio = player.getBitrateInfoListFor('audio') || [];
availableBitrates.video = player.getBitrateInfoListFor('video') || [];
Expand All @@ -525,7 +527,6 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
bitrateListBtn.classList.add('hide');
}
}

//Track Switch Menu
if (!trackSwitchMenu && trackSwitchBtn) {
var availableTracks = { menuType: 'track' };
Expand All @@ -545,7 +546,6 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
trackSwitchBtn.classList.remove('hide');
}
}

};

var onStreamTeardownComplete = function (/*e*/) {
Expand Down Expand Up @@ -864,6 +864,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
player.on(dashjs.MediaPlayer.events.TEXT_TRACKS_ADDED, onTracksAdded, this);
player.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED, onStreamInitialized, this);
player.on(dashjs.MediaPlayer.events.STREAM_TEARDOWN_COMPLETE, onStreamTeardownComplete, this);
player.on(dashjs.MediaPlayer.events.SOURCE_INITIALIZED, onSourceInitialized, this);

playPauseBtn.addEventListener('click', onPlayPauseClick);
muteBtn.addEventListener('click', onMuteClick);
Expand Down Expand Up @@ -953,6 +954,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) {
player.off(dashjs.MediaPlayer.events.TEXT_TRACKS_ADDED, onTracksAdded, this);
player.off(dashjs.MediaPlayer.events.STREAM_INITIALIZED, onStreamInitialized, this);
player.off(dashjs.MediaPlayer.events.STREAM_TEARDOWN_COMPLETE, onStreamTeardownComplete, this);
player.off(dashjs.MediaPlayer.events.SOURCE_INITIALIZED, onSourceInitialized, this);

document.removeEventListener('fullscreenchange', onFullScreenChange);
document.removeEventListener('MSFullscreenChange', onFullScreenChange);
Expand Down

0 comments on commit fe73c78

Please sign in to comment.