From eb29634a876a2a4d952a75dd01a1751b8af1802a Mon Sep 17 00:00:00 2001 From: Arthurk12 Date: Tue, 30 Apr 2024 14:49:41 -0300 Subject: [PATCH] fix(external-video): Youtube captions toggle Ensures setOption and unloadModule are functions before calling. --- .../ui/components/external-video-player/component.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/component.jsx b/bigbluebutton-html5/imports/ui/components/external-video-player/component.jsx index 5cff1fa3ad..40c9098fa2 100644 --- a/bigbluebutton-html5/imports/ui/components/external-video-player/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/external-video-player/component.jsx @@ -252,10 +252,14 @@ class VideoPlayer extends Component { }, () => { const { subtitlesOn } = this.state; const { isPresenter } = this.props; + const internalPlayer = this?.player?.getInternalPlayer(); + if (!internalPlayer) return; if (!isPresenter && subtitlesOn) { - this?.player?.getInternalPlayer()?.setOption('captions', 'reload', true); - } else { - this?.player?.getInternalPlayer()?.unloadModule('captions'); + if (typeof internalPlayer.setOption === 'function') { + internalPlayer.setOption('captions', 'reload', true); + } + } else if (typeof internalPlayer.unloadModule === 'function') { + internalPlayer.unloadModule('captions'); } }); }