fix(ui): unify titlebar and playback state
- window buttons live in the page header on library/search pages and in a shared chrome strip where a page has no header; removed the 44px root padding toggle that made pages jump on navigation - video player gets its own titlebar row with window controls; the audio player hides the global app bar - starting a video stops music and vice versa; a single track queues the rest of its album, or the artist's songs when AlbumId is missing - album page no longer crashes on albums without AlbumArtists - queue summary is localized
This commit is contained in:
1 parent
d9bce4de04
commit
fcf61012db
13 files changed
+245
-171
No files matched your search
@@ -59,6 +59,21 @@ export const playAudio = (
|
||||
playlistItemId?: string | undefined,
|
||||
startTimeTicks = 0,
|
||||
): void => {
|
||||
// Only one medium at a time: starting music stops video playback.
|
||||
if (typeof document !== "undefined") {
|
||||
const video = (document
|
||||
.querySelector("hls-video")
|
||||
?.shadowRoot?.querySelector("video") ??
|
||||
document.querySelector("video")) as HTMLVideoElement | null;
|
||||
if (video && !video.paused) video.pause();
|
||||
}
|
||||
void import("./playback").then(({ usePlaybackStore }) => {
|
||||
const state = usePlaybackStore.getState();
|
||||
if (state.mediaSource?.id || state.playerState.isPlayerPlaying) {
|
||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||
}
|
||||
});
|
||||
|
||||
useAudioPlayback.setState({
|
||||
display: true,
|
||||
url,
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from "../storage/player";
|
||||
import type audioPlaybackInfo from "../types/audioPlaybackInfo";
|
||||
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
|
||||
import { generateAudioStreamUrl, playAudio } from "./audioPlayback";
|
||||
import { generateAudioStreamUrl, playAudio, stopPlayback } from "./audioPlayback";
|
||||
import useQueue, { setQueue } from "./queue";
|
||||
|
||||
type PlaybackStoreState = {
|
||||
@@ -731,6 +731,9 @@ export const initializePlayback = async (args: {
|
||||
subtitleStreamIndex,
|
||||
} = args;
|
||||
|
||||
// Only one medium at a time: starting a video stops music playback.
|
||||
stopPlayback();
|
||||
|
||||
if (!mediaSource.MediaSources?.[0]?.Id) {
|
||||
throw new Error("Media source is undefined in initializePlayback");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user