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

Is there a way to retrieve the ReactNativeAudioStreaming play status? #131

Open
ardboer opened this issue Dec 27, 2017 · 1 comment
Open

Comments

@ardboer
Copy link

ardboer commented Dec 27, 2017

Cool module but I also like to know the status of the player to know if it is loading, playing or stopped.

@graphee-gabriel
Copy link

graphee-gabriel commented Mar 22, 2018

You can do it as such:

this.intervalIdStreamState = setInterval(() => {
  ReactNativeAudioStreaming.getStatus((error, info) => {
    let streamStatus
    if (error) {
      streamStatus = 'error'
      console.log(error);
    } else {
      streamStatus = info.status.toLowerCase()
    }
    if (this.state.streamStatus !== streamStatus) {
      console.log('streamStatus stream CHANGED', streamStatus)
      this.setState({ streamStatus }, () => this.onStreamStateChange(streamStatus))
    }
  })
}, 200)

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