Co-streaming (joint stream) mode in mobile app

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Co-streaming (joint stream) mode in mobile app
Complex
from 2 weeks to 3 months
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    757
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    874
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Co-Streaming (Joint Stream) in Mobile App

Co-streaming — two users broadcast simultaneously, see and hear each other in real time, viewers see both. Technically this is intersection of two different tasks: WebRTC (for peer-to-peer video between streamers) and RTMP/SRT (for broadcasting result to viewers). Combining them is non-trivial.

Co-Stream Architecture

Standard scheme:

Streamer A: camera → WebRTC → Signal Server ← WebRTC ← camera: Streamer B
                                     ↓
                            Mixing Server (SFU/MCU)
                                     ↓
                          RTMP → Twitch/YouTube/Custom

But on mobile additional variant without MCU — "client-side mixing". Streamer A receives Streamer B's video via WebRTC, mixes both streams locally via Metal/OpenGL, sends mixed stream to RTMP. Cheaper server-side but requires powerful processor and unstable if second participant has poor network.

In production for 1000+ simultaneous co-streams — only server MCU/SFU (LiveKit, mediasoup, Agora). For MVP with small load — client-side mixing works.

WebRTC on iOS and Android

iOS: GoogleWebRTC (CocoaPods) or WebRTC.xcframework from Google. Main object — RTCPeerConnection. Initialization:

let config = RTCConfiguration()
config.iceServers = [RTCIceServer(urlStrings: ["stun:stun.l.google.com:19302"],
                                  username: nil, credential: nil)]
config.sdpSemantics = .unifiedPlan

let constraints = RTCMediaConstraints(
    mandatoryConstraints: ["OfferToReceiveVideo": "true",
                           "OfferToReceiveAudio": "true"],
    optionalConstraints: nil
)
let peerConnection = factory.peerConnection(with: config,
                                            constraints: constraints,
                                            delegate: self)

Android: org.webrtc:google-webrtc:1.0.+ or io.getstream:stream-webrtc-android. Logic analogous via PeerConnection.

Signal server — WebSocket exchanging SDP offer/answer and ICE candidates between streamers. Write on Node.js (ws) or use ready-made — LiveKit Server, Agora RTM.

Problems We Encounter

Audio delay when mixing. When A hears B via WebRTC with 150–200ms delay, and stream formed from A's local audio, viewers hear desync. Solution: delay compensation via AVAudioPlayerNode.scheduleBuffer with explicit AVAudioTime so A's local audio in final stream delayed same as incoming from B.

Echo cancellation. If streamer has no headphones, microphone captures sound from speaker (WebRTC audio from partner). Built-in WebRTC AEC works only on RTCPeerConnection audio track. With custom audio pipeline need AVAudioEngine with AVAudioUnitEQ + own AEC or speex DSP.

Switching between co-stream and solo. When partner leaves co-stream need to smoothly remove their window from composition and rebuild layout without interrupting RTMP broadcast. Means: Metal render pass must check second texture presence and correctly render full-frame mode if second participant disconnected.

Signaling State for Viewers

Viewers should know it's a co-stream. In app — overlay with both streamers' avatars. Overlay state updates on change (partner connected/disconnected) via WebSocket event, not polling.

Timeline

Client-side co-stream (iOS, two participants, Metal composition, basic signal server): 5–7 weeks. Full implementation with MCU, Android support, AEC, state management: 8–12 weeks. Cost calculated individually after requirements analysis and architecture choice.