Ensure videoplayer is valid before setting allowCaptions

This commit is contained in:
1hitsong 2023-03-26 12:13:55 -04:00
parent 49608d906f
commit 8ded797668
2 changed files with 6 additions and 2 deletions

View File

@ -540,9 +540,11 @@ function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_
startMediaLoadingSpinner()
' Video is Playing
video = VideoPlayer(video_id, mediaSourceId, audio_stream_idx, defaultSubtitleTrackFromVid(video_id), forceTranscoding, showIntro, allowResumeDialog)
video.allowCaptions = true
if video = invalid then return invalid
video.allowCaptions = true
if video.errorMsg = "introaborted" then return video
video.observeField("selectSubtitlePressed", m.port)
video.observeField("selectPlaybackInfoPressed", m.port)

View File

@ -332,7 +332,9 @@ function PlayIntroVideo(video_id, audio_stream_idx) as boolean
if lcase(introVideos.items[0].name) = "rick roll'd" then return true
introVideo = VideoPlayer(introVideos.items[0].id, introVideos.items[0].id, audio_stream_idx, defaultSubtitleTrackFromVid(video_id), false, false)
introVideo.allowCaptions = false
if isValid(introVideo)
introVideo.allowCaptions = false
end if
port = CreateObject("roMessagePort")
introVideo.observeField("state", port)