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 forced subs #104

Merged
merged 5 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ sub init()
}

preferredSubtitle = m.global.queueManager.callFunc("getPreferredSubtitleTrack")
m.top.SelectedSubtitle = isChainValid(preferredSubtitle, "StreamIndex") ? preferredSubtitle.StreamIndex : -1
m.top.SelectedSubtitle = isChainValid(preferredSubtitle, "StreamIndex") ? preferredSubtitle.StreamIndex : -2
m.originalClosedCaptionState = invalid

' Load meta data
m.LoadMetaDataTask = CreateObject("roSGNode", "LoadVideoContentTask")
Expand Down Expand Up @@ -518,6 +519,10 @@ sub onVideoContentLoaded()
availableSubtitleTrackIndex = availSubtitleTrackIdx(selectedSubtitle.Track.TrackName)
if availableSubtitleTrackIndex <> -1
if not selectedSubtitle.IsEncoded
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
end if
m.top.globalCaptionMode = "On"
m.top.subtitleTrack = m.top.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName
end if
Expand Down Expand Up @@ -860,6 +865,11 @@ sub ReportPlayback(state = "update" as string)
m.bufferCheckTimer.duration = 30
end if

if inArray(["stop", "finished"], state) and isValid(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 })
Expand Down