jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 539 forks source link

Possibility of streaming audio over Websocket connection #172

Open sno6 opened 7 years ago

sno6 commented 7 years ago

Hello,

I see that this package saves the audio it receives from the microphone to a file on the device. Would it be possible to send the audio every n seconds over a Websocket connection instead?

Thanks, any help on this topic would be appreciated :)

zunair-syed commented 7 years ago

Yes please, can someone confirm if this is already possible....if not, is there an easy way to implement this? @sno6 were you able to find a solution?

zunair-syed commented 7 years ago

like i was thinking of a hacky solution where you would basically write to a file every n seconds by stopping the audio (by calling AudioRecorder.stopRecording() after n seconds) and then changing the path file and starting recording again and repeating the same thing....

@RakanNimer is there any current solution that you guys have?

zunair-syed commented 7 years ago

Or Maybe you can just return the chunk of audio you record every some seconds to a method callback in AudioRecorder...

zunair-syed commented 7 years ago

okay i got it working with my hacky solution but the performance isn't great....if anyone finds a good solution pls let me know

sno6 commented 7 years ago

I ended up doing the same as you @zunair-syed. If anyone has a better solution please let us know!

zunair-syed commented 7 years ago

oh ok. I'm actually still having problems with doing that properly. was your code open source? Would you mind sharing me your solution?

sno6 commented 7 years ago

@zunair-syed not sure if you got my email but I've made an audio streamer that works for iOS (will try tackle android too), if you're still needing a solution I can share it with you.

Noitidart commented 7 years ago

Can you guys @zunair-syed and @sno6 please share your solutions here. I was hoping to try it out as well.

MrLoh commented 7 years ago

@zunair-syed and @sno6 I am also having the same issues. Would really appreciate some help, if you have already solved the issue. Maybe we should bring forward a pull request here.

MrLoh commented 7 years ago

This has also already been discussed in https://github.com/jsierles/react-native-audio/issues/138 and there are some pointers, what to look out for.

sno6 commented 7 years ago

@Noitidart I ended up writing some objective-c code that did the buffering and Websocket communication for me, and then bridged it into my react code.

MrLoh commented 7 years ago

@sno6 would you be able to share some of your code? It would be great to create an open source implementation of a cross plattform react-native audio recording stream.

jiyarong commented 6 years ago

https://github.com/qiuxiang/react-native-recording I found an interesting project maybe can resolve your problem

MrLoh commented 6 years ago

We tried streaming audio to react native. But performance wise it is hard because the bridge gets very active and starts blocking everything so we reverted to building our analyzing functionality on the native side.