-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Feature Description
I would like to request seeking support for the StreamerNode when playing remote audio sources. Currently, StreamerNode allows streaming audio from a URL, but it appears to lack the capability to seek to a specific position or start playback from an offset.
Context & Problem
I am migrating my application's audio playback from expo-audio to react-native-audio-api.
While react-native-audio-api provides powerful graph-based audio processing, I hit a blocker with remote audio files (e.g., standard MP3/WAV hosted on S3/R2).
- Current Implementation: I use StreamerNode to play remote URLs.
- The Limitation: The StreamerNode API (
await node.start()) does not accept a time oroffsetparameter, nor does it expose aseekTo(seconds)method. - Result: Users cannot scrub through a podcast or voice note; they are forced to listen from the beginning every time.
Proposed Solution
Enhance StreamerNode to support seeking. This could be implemented in one of two ways:
-
seekToMethod:const streamer = await context.createStreamerNode(); streamer.setSource("https://example.com/audio.mp3"); await streamer.start(); // Later... await streamer.seekTo(30); // Seek to 30 seconds
-
Offset in start:
// Start playing from the 30-second mark await streamer.start({ offset: 30 });
Use Case
- Long-form Content: Podcasts, lectures, or long voice notes where listeners frequently skip sections or resume playback.
- Streaming Efficiency: Users shouldn't need to download the entire file (using
AudioPlayerNodewith a local file) just to seek. Streaming is preferred for startup performance.
Current Workaround
My current workaround is to revert to expo-audio or react-native-track-player for the specific use case of remote streaming media, while using react-native-audio-api for complex recording graphs. This creates a fragmented codebase. Having seeking support in StreamerNode would allow me to unify my audio stack.