Skip to content

Commit

Permalink
Replace global caption with JF video caption
Browse files Browse the repository at this point in the history
  • Loading branch information
jkim2492 committed Jan 27, 2023
1 parent 2fc121f commit 0bee595
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions source/utils/Subtitles.brs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ end function
function setupSubtitle(video, subtitles, subtitle_idx = -1) as integer
if subtitle_idx = -1
' If we are not using text-based subtitles, turn them off
video.globalCaptionMode = "Off"
' Turn captions on by default
video.captionVisible = True
return -1
end if

Expand All @@ -87,10 +88,11 @@ function setupSubtitle(video, subtitles, subtitle_idx = -1) as integer

if selectedSubtitle.IsEncoded
' With encoded subtitles, turn off captions
video.globalCaptionMode = "Off"
video.captionVisible = False
else
' If this is a text-based subtitle, set relevant settings for roku captions
video.globalCaptionMode = "On"
video.captionVisible = True

video.subtitleTrack = video.availableSubtitleTracks[availSubtitleTrackIdx(video, subtitleSelIdx)].TrackName
end if

Expand Down Expand Up @@ -165,8 +167,9 @@ sub changeSubtitleDuringPlayback(newid)
video.control = "play"
else
' Switching from text to text (or none to text) does not require stopping playback
video.globalCaptionMode = "On"
video.subtitleTrack = video.availableSubtitleTracks[availSubtitleTrackIdx(video, newid)].TrackName
video.captionVisible = True

end if

video.SelectedSubtitle = newid
Expand All @@ -177,7 +180,7 @@ sub turnoffSubtitles()
video = m.scene.focusedChild.focusedChild
current = video.SelectedSubtitle
video.SelectedSubtitle = -1
video.globalCaptionMode = "Off"
video.captionVisible = False
m.device.EnableAppFocusEvent(false)
' Check if Enoded subtitles are being displayed, and turn off
if current > -1 and video.Subtitles[current].IsEncoded
Expand Down

0 comments on commit 0bee595

Please sign in to comment.