From 8ded79766844583de07985663ca4f2822117dec3 Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Sun, 26 Mar 2023 12:13:55 -0400 Subject: [PATCH] Ensure videoplayer is valid before setting allowCaptions --- source/ShowScenes.brs | 4 +++- source/VideoPlayer.brs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs index 58a9d4e0..6d777ef2 100644 --- a/source/ShowScenes.brs +++ b/source/ShowScenes.brs @@ -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) diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index 902141d1..171bf7f1 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -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)