From d997d63d11e337ff4827009bdee5a4e0e04dfabc Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Mon, 31 Jan 2022 23:44:07 +0300 Subject: [PATCH 1/2] Fix theme song playback when switching items with different themes When you change an item with a theme to an item with a different theme, the backdrop tries to access the player. The latter has not yet started playing the new theme (`streamInfo` is null), but is already considered playing. A runtime error occurs when referring to null `streamInfo` (to check if the content type matches). To fix the problem, set `streamInfo` just before playback starts. --- src/components/playback/playbackmanager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 5e926f5f40..a03e25f036 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2385,8 +2385,11 @@ class PlaybackManager { streamInfo.fullscreen = playOptions.fullscreen; - getPlayerData(player).isChangingStream = false; - getPlayerData(player).maxStreamingBitrate = maxBitrate; + const playerData = getPlayerData(player); + + playerData.isChangingStream = false; + playerData.maxStreamingBitrate = maxBitrate; + playerData.streamInfo = streamInfo; return player.play(streamInfo).then(function () { loading.hide(); From 2d5e7f745f54da7917ad6768d3e9b58fcadf3e69 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Tue, 1 Feb 2022 00:33:42 +0300 Subject: [PATCH 2/2] Skip non-ready state of player in nowPlayingBar When nowPlayingBar receives an `init` event, some propertes of `state` are not yet defined. Wait for `playbackstart`. --- src/components/nowPlayingBar/nowPlayingBar.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/nowPlayingBar/nowPlayingBar.js b/src/components/nowPlayingBar/nowPlayingBar.js index daa2d3bf15..9b2d55c2f9 100644 --- a/src/components/nowPlayingBar/nowPlayingBar.js +++ b/src/components/nowPlayingBar/nowPlayingBar.js @@ -658,6 +658,11 @@ import { appRouter } from '../appRouter'; } function onStateChanged(event, state) { + if (event.type === 'init') { + // skip non-ready state + return; + } + console.debug('nowplaying event: ' + event.type); const player = this;