fix(external-video): Youtube captions toggle
Ensures setOption and unloadModule are functions before calling.
This commit is contained in:
parent
356f6331c1
commit
eb29634a87
@ -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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user