react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[Feature Request] (Question) seekTo without pausing other media?

Open kross-italk opened this issue 6 months ago • 1 comments

What is the need and use case of this feature?

  • Start a track in RNTP
  • Start a YouTube (premium) video, and put YouTube in the background. Other media playing apps (Spotify) are affected too.
  • Loop the track as needed
  • Let other media play alongside RNTP

Example code looks like

progressUpdateEventInterval: 1

TrackPlayer.addEventListener( Event.PlaybackProgressUpdated, handleProgressChange );
const handleProgressChange = async ( event ) => {
  const nearEnd = event.duration - 1;
  if ( event.position >= nearEnd ) {
   await TrackPlayer.seekTo( 0.0 ) // or 1.0, or .seekBy( -1 ), etc. 
  } 

When we .seekTo, we reset the player state and that causes the other media playing to pause. This might just be an unavoidable reality on Android. Is it possible to loop a track without interrupting other media?

Describe the ideal solution We want our media to keep looping in the background, while allowing other apps to keep playing.

Describe alternatives you've considered seeking the media swapping out the queue

Additional context Add any other context or screenshots about the feature request here.

How I can Help Can you assist by working on this feature and creating a Pull Request? Yes

kross-italk avatar Aug 02 '24 13:08 kross-italk