flutter-webrtc / flutter-webrtc

WebRTC plugin for Flutter Mobile/Desktop/Web
MIT License
4.02k stars 1.09k forks source link

Is it possible to capture the audio sent and received from an Android or iOS app? #1609

Open SoftMemes opened 3 weeks ago

SoftMemes commented 3 weeks ago

I've been trying to find a way to do this, but I'm not sure if it's currently possible. I know the README lists MediaRecorder with an exclamation mark for Android and iOS. I've also seen previous issues that appear related to this issue, but I'm not sure if they reflect the current state.

In short I need to be able to capture the microphone stream from an app at the same time as it's used in a WebRTC audio call - for local audio processing. I need the actual PCM audio for this, and not only the volume.

Is this possible?

jsyqrt commented 2 weeks ago

@SoftMemes I'm facing the same issue, did you find a way to do this?

SoftMemes commented 2 weeks ago

@SoftMemes I'm facing the same issue, did you find a way to do this?

@jsyqrt I'm afraid not. I would love if this was possible, but I haven't found anything in the exposed Dart APIs at least that would let me do this.

jsyqrt commented 2 weeks ago

@SoftMemes I'm facing the same issue, did you find a way to do this?

@jsyqrt I'm afraid not. I would love if this was possible, but I haven't found anything in the exposed Dart APIs at least that would let me do this.

Thanks for your reply, I'm searching for this too, and still, find nothing yet.

Prince-Addo commented 1 week ago

One effective solution is using a server to capture and process the audio stream in real-time. This ensures better performance and reliability. If you don't mind using a third-party service, check out MediaSFU. MediaSFU specializes in real-time audio and video stream processing and can capture the microphone stream during your WebRTC call, providing you with the PCM audio data you need.

This approach offloads the processing from the client device, simplifying your implementation and ensuring robust performance across different platforms.

jsyqrt commented 1 week ago

@Prince-Addo Hi, thanks for your reply and recommendation of MediaSFU and I'll try it later!

And yeah, I'm using a server to capture and process the audio stream now, with another platform called livekit, which also support self-hosted service as needed.