Split then/catch. Remove explicit player destroying

This commit is contained in:
Dmitry Lyzo 2020-10-29 22:08:06 +03:00
parent d969fc2cdb
commit f805bef9e5

View File

@ -2240,17 +2240,14 @@ class PlaybackManager {
const streamInfo = createStreamInfoFromUrlItem(item); const streamInfo = createStreamInfoFromUrlItem(item);
streamInfo.fullscreen = playOptions.fullscreen; streamInfo.fullscreen = playOptions.fullscreen;
getPlayerData(player).isChangingStream = false; getPlayerData(player).isChangingStream = false;
return player.play(streamInfo).then(function () { return player.play(streamInfo).then(() => {
loading.hide(); loading.hide();
onPlaybackStartedFn(); onPlaybackStartedFn();
onPlaybackStarted(player, playOptions, streamInfo); onPlaybackStarted(player, playOptions, streamInfo);
}, function () { }).catch(() => {
// TODO: show error message // TODO: show error message
self.stop(player); self.stop(player);
loading.hide(); loading.hide();
}).catch(() => {
player.destroy();
loading.hide();
}); });
}); });
} }