Android: Streaming audio over TCP Sockets

前端 未结 3 1390
小蘑菇
小蘑菇 2021-01-31 10:40

For my app, I need to record audio from MIC on an Android phone, and send it over TCP to the other android phone, where it needs to be played.

I am using AudioReco

3条回答
  •  醉酒成梦
    2021-01-31 11:07

    Without knowing the specific exception you're getting, it's hard to know exactly what's wrong. It would also help to see the code you're using to create out1 (that is, your socket code).

    Something you might want to pay attention to is the amount of data read from recordInstance.read(); you might not get a whole bufferSize-sized chunk of data out of it, so you need to take care only to write bytes 0 through bufferRead-1 to your output socket.

提交回复
热议问题