Hey, this library looks amazing and I see that you've considered a lot of the recommendations suggested by Google. I would like to know how would you play multiple files using this library. From what I understand, I'd have to import and create TrackPlayer multiple times and alias them but doesn't look feasible when the number of files to be played could be dynamic.
Like this:
import TrackPlayer as TrackPlayer1 from 'react-native-track-player'
import TrackPlayer as TrackPlayer2 from 'react-native-track-player'
import TrackPlayer as TrackPlayer3 from 'react-native-track-player'
I'm currently using react-native-sound wherein I have to create instances of the audio tracks, and they can be instantiated dynamically. So, multitrack playing simple to implement using react-native-sound.
What would be your approach to play multiple files together using this library?
Thank you!
As this module is meant to be used by music/podcast apps only, we don't support or plan to support playing multiple tracks at the same time. The reason for that is that the media controls and status is directly linked to the playing track.
I'd love to hear what use cases you have for multiple players. The only one we know is cross-fading, which should be implemented as a native transition.
@Guichaguri I have a use case for multitrack usage. I'm developing a guided meditation app. The app allows users to select music to play and also has a voice guidance feature. If music is playing and a user starts a voice guided meditation, the music volume would be reduced but continue playing in the background.
lol, have the exact same situation as @smkhalsa
I'm in the same situation as @nezaidu & @smkhalsa 馃ぃ
My question is also the same. My app plays 13 songs at a time like clap, drum, guitar and it's working with react-native-sound. But I am getting some sync issue between songs after some time playing it in Android. I am doing caching and creating dynamic instances for each songs and using for loop when play button clicks.
Can I use this plugin specially for multiple sound play instead of react-native-sound? @Guichaguri
@ashishpandey001 I am also facing the same issue.
No, you can't.
I've done track synchronization before, and I remember it being a hard thing to do if you don't have access to low-level APIs, unfortunately, you may need to build your own custom player that syncs the tracks together.
I have the same problem, in my case for a game with separate tracks for music and ambiance. I've tried expo-av, react-native-sound and react-native-audio-toolkit but they're all riddled with bugs :(
I have the same problem, in my case for a game with separate tracks for music and ambiance. I've tried expo-av, react-native-sound and react-native-audio-toolkit but they're all riddled with bugs :(
Did you figure out a solution to this by any chance, I have a similar requirement..
@TowhidKashem I ended up with this solution: https://github.com/expo/expo/issues/1873#issuecomment-592214795
@AdamGerthel thanks!
Most helpful comment
I'm in the same situation as @nezaidu & @smkhalsa 馃ぃ