|
|
|
@@ -20,11 +20,11 @@
|
|
|
|
|
import { createRustReportHost } from "$lib/player/adapters/rustReportHost";
|
|
|
|
|
import { isPipSupported, enterPip, setAutoEnterEnabled } from "$lib/utils/pictureInPicture";
|
|
|
|
|
import {
|
|
|
|
|
isBackgroundAudioSupported,
|
|
|
|
|
setBackgroundAudioEnabled,
|
|
|
|
|
subscribeAppBackgrounded,
|
|
|
|
|
subscribeAppForegrounded,
|
|
|
|
|
} from "$lib/utils/backgroundAudio";
|
|
|
|
|
import { platform } from "@tauri-apps/plugin-os";
|
|
|
|
|
import {
|
|
|
|
|
computeHandoffPosition,
|
|
|
|
|
initialHandoffState,
|
|
|
|
@@ -1178,8 +1178,14 @@
|
|
|
|
|
// playback off to the native ExoPlayer audio service; the WebView <video> is
|
|
|
|
|
// torn down so no video is decoded. Mutually exclusive with auto-PiP.
|
|
|
|
|
//
|
|
|
|
|
// Resolved synchronously (no await) for the same native-mode reason as PiP.
|
|
|
|
|
const backgroundAudioSupported = isBackgroundAudioSupported();
|
|
|
|
|
// Gate on the platform, NOT on the AndroidBackgroundAudio JS-bridge probe.
|
|
|
|
|
// The native isSupported() is unconditionally true on Android, but the bridge
|
|
|
|
|
// is injected into the WebView asynchronously and races component mount — a
|
|
|
|
|
// one-shot bridge probe here comes out false on some loads and, being a const,
|
|
|
|
|
// never recovers, so the button vanished on "some videos". platform() is
|
|
|
|
|
// available synchronously and is stable. toggleBackgroundAudio() no-ops safely
|
|
|
|
|
// if the bridge is momentarily absent.
|
|
|
|
|
const backgroundAudioSupported = platform() === "android";
|
|
|
|
|
let backgroundAudioOn = $state(false); // v1: default OFF each session
|
|
|
|
|
let handoffState: BackgroundAudioState = { ...initialHandoffState };
|
|
|
|
|
|
|
|
|
|