iOS native WebRTC recording

1,082 views
Skip to first unread message

Suman Cherukuri

unread,
Mar 27, 2019, 11:36:36 AM3/27/19
to discuss-webrtc
Hi,

I have an iOS native app using webrtc for p2p communication. One of my use cases require to record screen video and audio as well. I am able to recored the video using ReplyKit RPScreenRecorder's;

- (void)startCaptureWithHandler:(void (^)(CMSampleBufferRef sampleBuffer, RPSampleBufferType bufferType, NSError *error))captureHandler 
              completionHandler:(void (^)(NSError *error))completionHandler;

I am able to add the sample buffers if they are of type video (RPSampleBufferTypeVideo). But I don't get any audio buffers when WebRTC session is in progress.

I wrote a small sample and took WebRTC out and I am able to record both video and audio.

I spent a lot of time on this in the past one week and couldn't figure out a way to record audio (both local and remote) of a WebRTC session.

Please let me know what am I missing. Is there any way to get the sample audio buffers for both local and remote so that I can add them to my 
AVAssetWriterInput?

I am completely blocked on this now :-(

Thanks,

--Suman

Nagamuni reddy

unread,
Mar 27, 2019, 4:59:15 PM3/27/19
to discuss-webrtc
Hi Suman,

Unfortunately, you can use the audio channel once at a time. Either u get webrtc audio or the screen recording audio. 
To achieve your desired requirement, you need to save webrtc video and audio stream sampleBuffer data into avassetwriter, then you can have both audio and video files at a time.

Suman Cherukuri

unread,
Mar 27, 2019, 5:34:59 PM3/27/19
to discuss...@googlegroups.com
Thanks for the reply. 

Can you please point me to where can I hook into RTC code to get the buffers?

Thanks,

Suman

Sent from my iPhone
--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/FJx3QOlRe7E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/d12dd879-9d33-4719-bdeb-24f653cee99d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sanjay Kumawat

unread,
Feb 17, 2021, 3:23:13 AM2/17/21
to discuss-webrtc

you need to hook into the file name audio_device_ios.m in the method OnDeliverRecordedData for local audio and in the method OnGetPlayoutData for remote audio
Reply all
Reply to author
Forward
0 new messages