add extra subtitles only if stream is loaded

This commit is contained in:
nklhrstv 2020-12-15 11:44:09 +02:00
parent 0ad91c1410
commit 8126662957

View file

@ -223,17 +223,19 @@ const Player = ({ urlParams, queryParams }) => {
}
}, [streamingServer.baseUrl, player.selected, forceTranscoding, casting]);
useDeepEqualEffect(() => {
dispatch({
type: 'command',
commandName: 'addExtraSubtitlesTracks',
commandArgs: {
tracks: player.subtitles.map((subtitles, index) => ({
...subtitles,
id: `extra_${index}`,
label: subtitles.url
}))
}
});
if (videoState.stream !== null) {
dispatch({
type: 'command',
commandName: 'addExtraSubtitlesTracks',
commandArgs: {
tracks: player.subtitles.map((subtitles, index) => ({
...subtitles,
id: `extra_${index}`,
label: subtitles.url
}))
}
});
}
}, [player.subtitles, videoState.stream]);
React.useEffect(() => {
dispatch({ type: 'setProp', propName: 'extraSubtitlesSize', propValue: settings.subtitlesSize });