react-native-audio-streaming
react-native-audio-streaming copied to clipboard
Is there a way to retrieve the ReactNativeAudioStreaming play status?
Cool module but I also like to know the status of the player to know if it is loading, playing or stopped.
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)