Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Push covers base URL to now-playing service

Include coverBaseUrl in metadataFor and call
RockboxNowPlaying.setCoverBaseUrl
whenever the selected server changes so native now-playing can resolve
album_art while JS is suspended.

Add project(':rockbox-rpc') dependency to the Android now-playing module
to
reuse the JNI-bound external declarations.

+19 -2
+6 -2
expo/lib/now-playing-bridge.ts
··· 2 2 3 3 import { coverUrl } from "@/lib/cover-url"; 4 4 import { RockboxClient } from "@/lib/rockbox-client"; 5 - import { useSelectedServer } from "@/lib/server-store"; 5 + import { 6 + coversBaseUrl, 7 + useSelectedServer, 8 + } from "@/lib/server-store"; 6 9 import { 7 10 RockboxNowPlaying, 8 11 type NowPlayingMetadata, ··· 19 22 */ 20 23 export function metadataFor( 21 24 track: TrackSnapshot, 22 - _server: ReturnType<typeof useSelectedServer>, 25 + server: ReturnType<typeof useSelectedServer>, 23 26 ): NowPlayingMetadata { 24 27 let artworkUrl: string | null = null; 25 28 if (track.album_art) { ··· 35 38 artist: track.artist, 36 39 album: track.album, 37 40 artworkUrl, 41 + coverBaseUrl: coversBaseUrl(server), 38 42 durationMs: track.duration_ms, 39 43 }; 40 44 }
+9
expo/lib/rockbox-streams.tsx
··· 15 15 } from "@/lib/rockbox-client"; 16 16 import { 17 17 autoSelectFromDiscovery, 18 + coversBaseUrl, 18 19 hydrateSelectedServer, 19 20 useSelectedServer, 20 21 } from "@/lib/server-store"; ··· 42 43 serverRef.current = server; 43 44 const lastTrackRef = useRef<TrackSnapshot | null>(null); 44 45 const lastStatusRef = useRef<StatusSnapshot | null>(null); 46 + 47 + // Push the cover base URL into the now-playing service on every server 48 + // change so it can resolve `album_art` ids while JS is suspended. 49 + useEffect(() => { 50 + if (!nowPlayingEnabled()) return; 51 + const base = coversBaseUrl(server); 52 + if (base) RockboxNowPlaying.setCoverBaseUrl(base); 53 + }, [server]); 45 54 46 55 const startDiscovery = useCallback(() => { 47 56 // Tear down the previous browse, if any, so we get a fresh
+4
expo/modules/rockbox-now-playing/android/build.gradle
··· 20 20 implementation 'androidx.core:core-ktx:1.13.1' 21 21 implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' 22 22 implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' 23 + // Reuse RockboxRpcModule's @JvmStatic external fun declarations — those 24 + // are the only things bound to the actual JNI symbols emitted by 25 + // crates/expo (`Java_expo_modules_rockboxrpc_RockboxRpcModule_*`). 26 + implementation project(':rockbox-rpc') 23 27 }