'How to send CMSampleBuffer to WebRTC?

So I am using Replaykit to try stream my phone screen on a web browser.

override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
    //if source!.isSocketConnected {
    switch sampleBufferType {
    case RPSampleBufferType.video:
        // Handle video sample buffer
        
        break
    case RPSampleBufferType.audioApp:
        // Handle audio sample buffer for app audio
        
        break
    case RPSampleBufferType.audioMic:
        // Handle audio sample buffer for mic audio
        break
    @unknown default:
        break
    }
}

So how do we send that data to WebRTC? In order to use WebRTC, I learned that you need a signaling server. Is it possible to start a signaling server on your mobile, just like http server?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source