indiecastfm / react-native-audio-streamer

A react-native audio streaming module which works on both iOS & Android
MIT License
132 stars 50 forks source link

Issue know the current time #23

Open raouldandresy opened 6 years ago

raouldandresy commented 6 years ago

Hi :) i'm trying to do a progress bar that use the percentage, so i need the duration and the currenti time. But i'm using a while loop that is not working, anyone can help?

_statusChanged(status) { console.log(status); RNAudioStreamer.duration((err, duration)=>{ if(!err){ console.log(duration); this.setState({duration: duration}); } //seconds }) while(status === 'PLAYING'){ RNAudioStreamer.currentTime((err, currentTime)=>{ if(!err){ console.log(currentTime); this.setState({currentTime: currentTime}); }//seconds }) } }