Skip to content

Commit

Permalink
Merge pull request #1608 from 1hitsong/fixTextSubtitleChange
Browse files Browse the repository at this point in the history
Fix subtitle selection for subtitles that are not encoded
  • Loading branch information
1hitsong authored Jan 2, 2024
2 parents b9e55e0 + a37c7d9 commit f4a3c12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/manager/ViewCreator.bs
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,20 @@ sub processSubtitleSelection()
end if

if m.selectedSubtitle.IsEncoded
' Roku can not natively display these subtitles, so turn off the caption mode on the device
m.view.globalCaptionMode = "Off"
else
' Roku can natively display these subtitles, ensure the caption mode on the device is 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)
if availableSubtitleTrackIndex = -1 then return

m.view.subtitleTrack = m.view.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName
else
m.view.selectedSubtitle = m.selectedSubtitle.Index
end if

m.view.selectedSubtitle = m.selectedSubtitle.Index
end sub

' User requested playback info
Expand Down
3 changes: 3 additions & 0 deletions components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ 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

' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)

Expand Down

0 comments on commit f4a3c12

Please sign in to comment.