Merge pull request #20153 from prlanzarin/u27/fix/Arthurk12-live-crashes-1800

fix(bbb-html5): potential crash in Youtube captions toggle
This commit is contained in:
Anton Georgiev 2024-05-02 16:03:04 -04:00 committed by GitHub
commit 15e857abe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -252,10 +252,14 @@ class VideoPlayer extends Component {
}, () => { }, () => {
const { subtitlesOn } = this.state; const { subtitlesOn } = this.state;
const { isPresenter } = this.props; const { isPresenter } = this.props;
const internalPlayer = this?.player?.getInternalPlayer();
if (!internalPlayer) return;
if (!isPresenter && subtitlesOn) { if (!isPresenter && subtitlesOn) {
this?.player?.getInternalPlayer()?.setOption('captions', 'reload', true); if (typeof internalPlayer.setOption === 'function') {
} else { internalPlayer.setOption('captions', 'reload', true);
this?.player?.getInternalPlayer()?.unloadModule('captions'); }
} else if (typeof internalPlayer.unloadModule === 'function') {
internalPlayer.unloadModule('captions');
} }
}); });
} }