Skip to content

Commit c1f889d

Browse files
authored
Fix scheduleWhilePaused not working (#3785)
* Fix scheduleWhilePaused not working
1 parent ea3d3b9 commit c1f889d

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/streaming/controllers/ScheduleController.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ function ScheduleController(config) {
192192
*/
193193
function _shouldClearScheduleTimer() {
194194
try {
195-
return (((type === Constants.TEXT) && !textController.isTextEnabled()));
195+
return (((type === Constants.TEXT) && !textController.isTextEnabled()) ||
196+
(playbackController.isPaused() && (!playbackController.getStreamController().getInitialPlayback() || !playbackController.getStreamController().getAutoPlay()) && !settings.get().streaming.scheduling.scheduleWhilePaused));
196197
} catch (e) {
197198
return false;
198199
}

src/streaming/controllers/StreamController.js

+24-3
Original file line numberDiff line numberDiff line change
@@ -752,11 +752,14 @@ function StreamController() {
752752
* @private
753753
*/
754754
function _onPlaybackStarted( /*e*/) {
755-
logger.debug('[onPlaybackStarted]');
756-
if (!initialPlayback && isPaused) {
757-
isPaused = false;
755+
logger.debug('[onPlaybackStarted]');
756+
if (!initialPlayback && isPaused) {
758757
createPlaylistMetrics(PlayList.RESUME_FROM_PAUSE_START_REASON);
759758
}
759+
if (initialPlayback) {
760+
initialPlayback = false;
761+
}
762+
isPaused = false;
760763
}
761764

762765
/**
@@ -984,6 +987,22 @@ function StreamController() {
984987
return activeStream;
985988
}
986989

990+
/**
991+
* Initial playback indicates if we have called play() for the first time yet.
992+
* @return {*}
993+
*/
994+
function getInitialPlayback() {
995+
return initialPlayback;
996+
}
997+
998+
/**
999+
* Auto Play indicates if the stream starts automatically as soon as it is initialized.
1000+
* @return {boolean}
1001+
*/
1002+
function getAutoPlay() {
1003+
return autoPlay;
1004+
}
1005+
9871006
/**
9881007
* Called once the first stream has been initialized. We only use this function to seek to the right start time.
9891008
* @return {number}
@@ -1504,6 +1523,8 @@ function StreamController() {
15041523
getHasMediaOrInitialisationError,
15051524
getStreams,
15061525
getActiveStream,
1526+
getInitialPlayback,
1527+
getAutoPlay,
15071528
reset
15081529
};
15091530

0 commit comments

Comments
 (0)