Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scheduleWhilePaused not working #3785

Merged
merged 9 commits into from
Oct 12, 2021
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ function ScheduleController(config) {
*/
function _shouldClearScheduleTimer() {
try {
return (((type === Constants.TEXT) && !textController.isTextEnabled()));
return (((type === Constants.TEXT) && !textController.isTextEnabled()) ||
(playbackController.isPaused() && (!playbackController.getStreamController().getInitialPlayback() || !playbackController.getStreamController().getAutoPlay()) && !settings.get().streaming.scheduling.scheduleWhilePaused));
} catch (e) {
return false;
}
Expand Down
21 changes: 21 additions & 0 deletions src/streaming/controllers/StreamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ function StreamController() {
*/
function _onPlaybackStarted( /*e*/) {
logger.debug('[onPlaybackStarted]');
if (initialPlayback) {
chanh1964 marked this conversation as resolved.
Show resolved Hide resolved
initialPlayback = false;
}
if (!initialPlayback && isPaused) {
isPaused = false;
createPlaylistMetrics(PlayList.RESUME_FROM_PAUSE_START_REASON);
Expand Down Expand Up @@ -984,6 +987,22 @@ function StreamController() {
return activeStream;
}

/**
* Initial playback indicates if we have called play() for the first time yet.
* @return {*}
*/
function getInitialPlayback() {
return initialPlayback;
}

/**
* Auto Play indicates if the stream starts automatically as soon as it is initialized.
* @return {boolean}
*/
function getAutoPlay() {
return autoPlay;
}

/**
* Called once the first stream has been initialized. We only use this function to seek to the right start time.
* @return {number}
Expand Down Expand Up @@ -1504,6 +1523,8 @@ function StreamController() {
getHasMediaOrInitialisationError,
getStreams,
getActiveStream,
getInitialPlayback,
getAutoPlay,
reset
};

Expand Down