fix(player): show background-audio button on all Android video playback

The audio-only (background-audio) button was gated on the
AndroidBackgroundAudio JS-bridge probe, resolved once as a const at mount.
The bridge is injected into the WebView asynchronously and races component
mount, so on some loads the probe returned false and never recovered,
hiding the button on 'some videos' at random.

Gate on platform() === 'android' instead (synchronous, stable), matching
the convention in VolumeControl. toggleBackgroundAudio() already no-ops if
the bridge is momentarily absent.

Bump version to 0.0.18.
This commit is contained in:
2026-07-24 20:32:08 +02:00
parent 514e42fccb
commit 5e17628934
3 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "jellytau", "name": "jellytau",
"version": "0.0.16", "version": "0.0.18",
"description": "", "description": "",
"type": "module", "type": "module",
"packageManager": "bun@1.3.5", "packageManager": "bun@1.3.5",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "jellytau", "productName": "jellytau",
"version": "0.0.16", "version": "0.0.18",
"identifier": "com.dtourolle.jellytau", "identifier": "com.dtourolle.jellytau",
"build": { "build": {
"beforeDevCommand": "bun run dev", "beforeDevCommand": "bun run dev",
+9 -3
View File
@@ -20,11 +20,11 @@
import { createRustReportHost } from "$lib/player/adapters/rustReportHost"; import { createRustReportHost } from "$lib/player/adapters/rustReportHost";
import { isPipSupported, enterPip, setAutoEnterEnabled } from "$lib/utils/pictureInPicture"; import { isPipSupported, enterPip, setAutoEnterEnabled } from "$lib/utils/pictureInPicture";
import { import {
isBackgroundAudioSupported,
setBackgroundAudioEnabled, setBackgroundAudioEnabled,
subscribeAppBackgrounded, subscribeAppBackgrounded,
subscribeAppForegrounded, subscribeAppForegrounded,
} from "$lib/utils/backgroundAudio"; } from "$lib/utils/backgroundAudio";
import { platform } from "@tauri-apps/plugin-os";
import { import {
computeHandoffPosition, computeHandoffPosition,
initialHandoffState, initialHandoffState,
@@ -1178,8 +1178,14 @@
// playback off to the native ExoPlayer audio service; the WebView <video> is // playback off to the native ExoPlayer audio service; the WebView <video> is
// torn down so no video is decoded. Mutually exclusive with auto-PiP. // torn down so no video is decoded. Mutually exclusive with auto-PiP.
// //
// Resolved synchronously (no await) for the same native-mode reason as PiP. // Gate on the platform, NOT on the AndroidBackgroundAudio JS-bridge probe.
const backgroundAudioSupported = isBackgroundAudioSupported(); // 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 backgroundAudioOn = $state(false); // v1: default OFF each session
let handoffState: BackgroundAudioState = { ...initialHandoffState }; let handoffState: BackgroundAudioState = { ...initialHandoffState };