Only tracklist if we're actually audible.

This commit is contained in:
Matthew Stratford 2021-01-05 23:57:14 +00:00
parent 658ef5f1eb
commit cc5f24580d
No known key found for this signature in database
GPG key ID: 9E53C8B3F0B57395

View file

@ -584,10 +584,21 @@ export const play = (player: number): AppThunk => async (
}
audioEngine.players[player]?.play();
// If we're starting off audible, try and tracklist.
if (state.volume > 0) {
dispatch(attemptTracklist(player));
}
};
const attemptTracklist = (player: number): AppThunk => async (
dispatch,
getState
) => {
const state = getState().mixer.players[player];
if (state.loadedItem && "album" in state.loadedItem) {
//track
console.log("potentially tracklisting", state.loadedItem);
if (getState().mixer.players[player].tracklistItemID === -1) {
if (state.tracklistItemID === -1) {
dispatch(BroadcastState.tracklistStart(player, state.loadedItem.trackid));
} else {
console.log("not tracklisting because already tracklisted");
@ -702,9 +713,11 @@ export const setVolume = (
}
}
// If we're fading up the volume, disable the PFL.
if (level !== "off") {
// If we're fading up the volume, disable the PFL.
dispatch(setChannelPFL(player, false));
// Also catch a tracklist if we started with the channel off.
dispatch(attemptTracklist(player));
}
// If not fading, just do it.