Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kross-italk opened this issue Aug 2, 2024 · 1 comment
Open

Comments

@kross-italk
Copy link

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

@lovegaoshi
Copy link
Contributor

is this for android?
if so u need to disable auto audio focus handling. https://rntp.dev/docs/api/objects/player-options autoHandleInterruptions
and read up audio focus on android.

though i do remember there is some weird bug with this, i think its audio focus is still stolen on app start. ud want to look that up in the questions channel in the discord group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants