fix(remote playback): Move audio between remote players
This commit is contained in:
@@ -28,6 +28,7 @@ vi.mock("$lib/stores/queue", () => ({
|
||||
setQueue: vi.fn(),
|
||||
addToQueue: vi.fn(),
|
||||
},
|
||||
currentQueueItem: { subscribe: vi.fn((fn: any) => { fn(null); return () => {}; }) },
|
||||
}));
|
||||
|
||||
vi.mock("./DownloadButton.svelte", () => ({
|
||||
|
||||
@@ -13,6 +13,7 @@ import type { MediaItem, ItemType } from "$lib/api/types";
|
||||
import type { NowPlayingItem } from "$lib/api/bindings";
|
||||
import { isRemoteMode } from "./playbackMode";
|
||||
import { selectedSession } from "./sessions";
|
||||
import { currentQueueItem } from "./queue";
|
||||
import { ticksToSeconds } from "$lib/utils/playbackUnits";
|
||||
|
||||
// Merged media item from backend (matches Rust MergedMediaItem)
|
||||
@@ -257,21 +258,24 @@ export const mergedVolume = derived(
|
||||
* AND current media is audio (not video: Movie or Episode)
|
||||
*/
|
||||
export const shouldShowAudioMiniPlayer = derived(
|
||||
[player, currentMedia, isRemoteMode, selectedSession],
|
||||
([$player, $media, $isRemote, $session]) => {
|
||||
[player, currentMedia, currentQueueItem, isRemoteMode, selectedSession],
|
||||
([$player, $media, $queueItem, $isRemote, $session]) => {
|
||||
// In remote mode, show if the remote session has a now-playing item
|
||||
if ($isRemote && $session?.nowPlayingItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Local mode: only show when actively playing or paused
|
||||
// Local mode: hide only when there is genuinely nothing loaded
|
||||
// (idle/stopped/error). Keep showing through loading/seeking transitions
|
||||
// so the mini player doesn't blink out when advancing between tracks.
|
||||
const state = $player.state;
|
||||
if (state.kind !== "playing" && state.kind !== "paused") {
|
||||
if (state.kind === "idle" || state.kind === "error") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't show for video content
|
||||
const mediaType = $media?.type;
|
||||
// Determine media type from the player state, falling back to the queue
|
||||
// item (the player store can momentarily lack media during transitions).
|
||||
const mediaType = $media?.type ?? $queueItem?.type;
|
||||
if (mediaType === "Movie" || mediaType === "Episode") {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,10 +136,10 @@
|
||||
<BottomNav />
|
||||
{/if}
|
||||
|
||||
<!-- Mini Player - show everywhere except on full player page and login -->
|
||||
<!-- Android: Show on all routes (except player/login) -->
|
||||
<!-- Mini Player - show everywhere except on full player page, login and settings -->
|
||||
<!-- Android: Show on all routes (except player/login/settings) -->
|
||||
<!-- Desktop: Show on non-library routes (library layout has its own MiniPlayer) -->
|
||||
{#if !$page.url.pathname.startsWith('/player/') && !$page.url.pathname.startsWith('/login')}
|
||||
{#if !$page.url.pathname.startsWith('/player/') && !$page.url.pathname.startsWith('/login') && !$page.url.pathname.startsWith('/settings')}
|
||||
{#if $isAndroid || !$page.url.pathname.startsWith('/library')}
|
||||
<MiniPlayer
|
||||
media={$currentMedia}
|
||||
|
||||
Reference in New Issue
Block a user