From da9440387d4235915629c4f17a39612c31aae8e2 Mon Sep 17 00:00:00 2001 From: Jimi Date: Sun, 3 Nov 2024 06:44:33 -0700 Subject: [PATCH] Remeber Roku subs settings for videos with Forced subs --- components/video/VideoPlayerView.bs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs index 215f06821..109a5569c 100644 --- a/components/video/VideoPlayerView.bs +++ b/components/video/VideoPlayerView.bs @@ -9,6 +9,7 @@ sub init() m.top.getScene().findNode("overhang").visible = false userSettings = m.global.session.user.settings m.currentItem = m.global.queueManager.callFunc("getCurrentItem") + m.originalClosedCaptionState = invalid m.top.id = m.currentItem.id m.top.seekMode = "accurate" @@ -461,7 +462,12 @@ sub onVideoContentLoaded() availableSubtitleTrackIndex = availSubtitleTrackIdx(selectedSubtitle.Track.TrackName) if availableSubtitleTrackIndex <> -1 if not selectedSubtitle.IsEncoded - m.top.globalCaptionMode = "On" + if selectedSubtitle.IsForced + ' If IsForced, make sure to remember the Roku global setting so we + ' can set it back when the video is done playing. + m.originalClosedCaptionState = m.top.globalCaptionMode + m.top.globalCaptionMode = "On" + end if m.top.subtitleTrack = m.top.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName end if end if @@ -697,6 +703,12 @@ sub ReportPlayback(state = "update" as string) m.bufferCheckTimer.duration = 30 end if + if (state = "stop" or state = "finished") and m.originalClosedCaptionState <> invalid + m.log.debug("ReportPlayback() setting", m.top.globalCaptionMode, "back to", m.originalClosedCaptionState) + m.top.globalCaptionMode = m.originalClosedCaptionState + m.originalClosedCaptionState = invalid + end if + ' Report playstate via worker task playstateTask = m.global.playstateTask playstateTask.setFields({ status: state, params: params })