diff --git a/app/js/streaming/BufferController.js b/app/js/streaming/BufferController.js index f2c8eb3750..df436b5b54 100644 --- a/app/js/streaming/BufferController.js +++ b/app/js/streaming/BufferController.js @@ -302,7 +302,7 @@ MediaPlayer.dependencies.BufferController = function () { rejectedBytes = null; } - if (!self.requestScheduler.isScheduled(self)) { + if (!self.requestScheduler.isScheduled(self) && isSchedulingRequired.call(self)) { doStart.call(self); } @@ -766,6 +766,13 @@ MediaPlayer.dependencies.BufferController = function () { } } }, + + isSchedulingRequired = function() { + var isPaused = this.videoModel.isPaused(); + + return (!isPaused || (isPaused && this.scheduleWhilePaused)); + }, + /* mseGetDesiredTime = function () { var ranges = buffer.buffered, @@ -884,6 +891,11 @@ MediaPlayer.dependencies.BufferController = function () { checkIfSufficientBuffer.call(self); //mseSetTimeIfPossible.call(self); + if (!isSchedulingRequired.call(self) && !initialPlayback) { + doStop.call(self); + return; + } + if (state === LOADING && bufferLevel < STALL_THRESHOLD) { if (!stalled) { self.debug.log("Stalling " + type + " Buffer: " + type); @@ -976,6 +988,7 @@ MediaPlayer.dependencies.BufferController = function () { debug: undefined, system: undefined, errHandler: undefined, + scheduleWhilePaused: undefined, initialize: function (type, periodInfo, data, buffer, videoModel, scheduler, fragmentController, source) { var self = this, diff --git a/app/js/streaming/MediaPlayer.js b/app/js/streaming/MediaPlayer.js index 92ac40a44c..c8da94692f 100644 --- a/app/js/streaming/MediaPlayer.js +++ b/app/js/streaming/MediaPlayer.js @@ -80,6 +80,7 @@ MediaPlayer = function (aContext) { streamController.load(source); system.mapValue("scheduleWhilePaused", scheduleWhilePaused); system.mapOutlet("scheduleWhilePaused", "stream"); + system.mapOutlet("scheduleWhilePaused", "bufferController"); system.mapValue("bufferMax", bufferMax); system.injectInto(this.bufferExt, "bufferMax"); }, diff --git a/app/js/streaming/Stream.js b/app/js/streaming/Stream.js index 1a41cd917d..dd65f9d039 100644 --- a/app/js/streaming/Stream.js +++ b/app/js/streaming/Stream.js @@ -496,6 +496,7 @@ MediaPlayer.dependencies.Stream = function () { onPlay = function () { this.debug.log("Got play event."); + startBuffering.call(this); }, onPause = function () { @@ -589,6 +590,15 @@ MediaPlayer.dependencies.Stream = function () { } }, + startBuffering = function() { + if (videoController) { + videoController.start(); + } + if (audioController) { + audioController.start(); + } + }, + stopBuffering = function() { if (videoController) { videoController.stop();