Merge pull request #1632 from 1hitsong/subtitleTurnOffBug

Prevent unneeded video stop/start when turning off text subtitles
This commit is contained in:
1hitsong 2024-01-12 17:01:55 -05:00 committed by GitHub
commit 5854b787a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -99,6 +99,14 @@ sub processSubtitleSelection()
' The playbackData is now outdated and must be refreshed
m.playbackData = invalid
' Find previously selected subtitle and identify if it was encoded
for each item in m.view.fullSubtitleData
if item.index = m.view.selectedSubtitle
m.view.previousSubtitleWasEncoded = item.IsEncoded
exit for
end if
end for
if LCase(m.selectedSubtitle.track.description) = "none"
m.view.globalCaptionMode = "Off"
m.view.subtitleTrack = ""

View File

@ -256,8 +256,17 @@ end sub
' Event handler for when selectedSubtitle changes
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
switchWithoutRefresh = true
if m.top.SelectedSubtitle <> -1
' If the global caption mode is off, then Roku can't display the subtitles natively and needs a video stop/start
if LCase(m.top.globalCaptionMode) <> "on" then switchWithoutRefresh = false
end if
' If previous sustitle was encoded, then we need to a video stop/start to change subtitle content
if m.top.previousSubtitleWasEncoded then switchWithoutRefresh = false
if switchWithoutRefresh then return
' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)

View File

@ -7,6 +7,7 @@
<field id="PlaySessionId" type="string" />
<field id="Subtitles" type="array" />
<field id="SelectedSubtitle" type="integer" value="-2" alwaysNotify="true" />
<field id="previousSubtitleWasEncoded" type="boolean" />
<field id="container" type="string" />
<field id="directPlaySupported" type="boolean" />
<field id="systemOverlay" type="boolean" value="false" />