Merge pull request #1608 from 1hitsong/fixTextSubtitleChange

Fix subtitle selection for subtitles that are not encoded
This commit is contained in:
1hitsong 2024-01-02 07:57:18 -05:00 committed by GitHub
commit f4a3c12cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -111,19 +111,20 @@ sub processSubtitleSelection()
end if end if
if m.selectedSubtitle.IsEncoded if m.selectedSubtitle.IsEncoded
' Roku can not natively display these subtitles, so turn off the caption mode on the device
m.view.globalCaptionMode = "Off" m.view.globalCaptionMode = "Off"
else else
' Roku can natively display these subtitles, ensure the caption mode on the device is on
m.view.globalCaptionMode = "On" m.view.globalCaptionMode = "On"
end if
if m.selectedSubtitle.IsExternal ' Roku may rearrange subtitle tracks. Look up track based on name to ensure we get the correct index
availableSubtitleTrackIndex = availSubtitleTrackIdx(m.selectedSubtitle.Track.TrackName) availableSubtitleTrackIndex = availSubtitleTrackIdx(m.selectedSubtitle.Track.TrackName)
if availableSubtitleTrackIndex = -1 then return if availableSubtitleTrackIndex = -1 then return
m.view.subtitleTrack = m.view.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName m.view.subtitleTrack = m.view.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName
else
m.view.selectedSubtitle = m.selectedSubtitle.Index
end if end if
m.view.selectedSubtitle = m.selectedSubtitle.Index
end sub end sub
' User requested playback info ' User requested playback info

View File

@ -256,6 +256,9 @@ end sub
' Event handler for when selectedSubtitle changes ' Event handler for when selectedSubtitle changes
sub onSubtitleChange() sub onSubtitleChange()
' If the global caption mode is on, that means Roku can display the subtitles natively and doesn't need a video stop/start
if LCase(m.top.globalCaptionMode) = "on" then return
' Save the current video position ' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&) m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)