-
-
Notifications
You must be signed in to change notification settings - Fork 977
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
How to use with react component #63
Comments
As you have mentioned, You can update your redux store with new information from the headless task. |
How to access store in the headless task ? |
You should just be able to import it? I use Mobx, so I just |
You also can just pass it to the function like so: // index
const store = ...
....registerHeadlessTask('TrackPlayer', () => require('event-handler.js').bind(null, store)); // event-handler.js
module.exports = async (store, data) {
if(data.type == '...') {
store.dispatch(...);
}
}; |
Thanks for the help, it works |
Thanks for help @Guichaguri |
Thanks for the help. It works |
Hi,
Before checking this component, I used react-native-video to play my stream file.
My component looks like this:
Since react-native-video is not working great on android while playing in background, i was looking for this component but I do now understand how I am supposed to use redux to dispatch action to the player.
In my app, my ui component dispatch redux actions like Play, Pause, etc. I have a component over my audioplayer bind to redux that pass props to my AudioPlayer to update it depending on user action.
My question: How can I accomplish similar lifecycle using this component ? All the events are in the headless task and I do not understant how am i supposed to update the props of my components using this.
I want to keep a similar API for my component as I am going to use react-native-track-player only on android.
Thank you.
The text was updated successfully, but these errors were encountered: