Skip to content

Commit

Permalink
Won't seek while transitioning period if track is only video or audio…
Browse files Browse the repository at this point in the history
…, using logger
  • Loading branch information
aescarcha committed Jun 8, 2018
1 parent 41bf7c6 commit c18e23b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/streaming/SourceBufferSink.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function SourceBufferSink(mediaSource, mediaInfo, onAppendedCallback, oldBuffer)
try {
return buffer.buffered;
} catch (e) {
log('getAllBufferRanges exception: ' + e.message);
logger.error('getAllBufferRanges exception: ' + e.message);
return null;
}
}
Expand Down Expand Up @@ -298,7 +298,7 @@ function SourceBufferSink(mediaSource, mediaInfo, onAppendedCallback, oldBuffer)
}

function errHandler() {
log('SourceBufferSink error', mediaInfo.type);
logger.error('SourceBufferSink error', mediaInfo.type);
}


Expand Down
2 changes: 1 addition & 1 deletion src/streaming/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ function Stream(config) {
if (streamProcessors.length === 0) {
let msg = 'No streams to play.';
errHandler.manifestError(msg, 'nostreams', manifestModel.getValue());
log(msg);
logger.debug(msg);
} else {
checkIfInitializationCompleted();
}
Expand Down
8 changes: 3 additions & 5 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,8 @@ function PlaybackController() {
ranges = bufferedRange[streamInfo.id].video;
}
if (checkTimeInRanges(earliestTime, ranges)) {
if (!isSeeking()) {
if (!compatibleWithPreviousStream) {
seek(earliestTime, true);
}
if (!isSeeking() && !compatibleWithPreviousStream) {
seek(earliestTime, true);
}
commonEarliestTime[streamInfo.id].started = true;
}
Expand All @@ -646,7 +644,7 @@ function PlaybackController() {
//current stream has only audio or only video content
if (commonEarliestTime[streamInfo.id][type]) {
earliestTime = commonEarliestTime[streamInfo.id][type] > initialStartTime ? commonEarliestTime[streamInfo.id][type] : initialStartTime;
if (!isSeeking()) {
if (!isSeeking() && !compatibleWithPreviousStream) {
seek(earliestTime);
}
commonEarliestTime[streamInfo.id].started = true;
Expand Down
4 changes: 2 additions & 2 deletions src/streaming/controllers/StreamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function StreamController() {
logger.debug('[toggleEndPeriodTimer] start-up of timer to notify PLAYBACK_ENDED event. It will be triggered in ' + delayPlaybackEnded + ' milliseconds');
playbackEndedTimerId = setTimeout(function () {eventBus.trigger(Events.PLAYBACK_ENDED);}, delayPlaybackEnded);
const preloadDelay = delayPlaybackEnded < 2000 ? delayPlaybackEnded / 4 : delayPlaybackEnded - 2000;
log('[StreamController][toggleEndPeriodTimer] Going to fire preload in ' + preloadDelay);
logger.info('[StreamController][toggleEndPeriodTimer] Going to fire preload in ' + preloadDelay);
setTimeout(onStreamCanLoadNext, preloadDelay);
}
}
Expand All @@ -319,7 +319,7 @@ function StreamController() {
const newStream = getNextStream();
compatible = activeStream.isCompatibleWithStream(newStream);
if (compatible) {
log('[StreamController][onStreamCanLoadNext] Preloading next stream');
logger.info('[StreamController][onStreamCanLoadNext] Preloading next stream');
activeStream.stopEventController();
activeStream.deactivate(true);
newStream.preload(mediaSource, buffers);
Expand Down

0 comments on commit c18e23b

Please sign in to comment.