Integrating Live Streaming into a Mobile App

Integrating Live Streaming into a Mobile App When trying to add live streaming to a fitness app, our client faced a delay of over 20 seconds on HLS. The trainer performed an exercise, but viewers saw his actions with a lag — destroying interactivity. We proposed an alternative: WebRTC with 500 ms

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 1All 1734 services
Integrating Live Streaming into a Mobile App
Complex
from 1 week to 3 months

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    896
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    783
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1004
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    598

Integrating Live Streaming into a Mobile App

When trying to add live streaming to a fitness app, our client faced a delay of over 20 seconds on HLS. The trainer performed an exercise, but viewers saw his actions with a lag — destroying interactivity. We proposed an alternative: WebRTC with 500 ms latency and HLS for recording. WebRTC provides 30x lower delay than HLS. In 4 weeks, we deployed a system that handled 10,000 concurrent viewers. Request an audit of your app — we will determine the optimal architecture.

Main Technical Problems

Latency and buffering. HLS chops the stream into 6-second segments, resulting in 15–30 s delay. For interactivity (voting, chat), this is unacceptable. LL-HLS reduces to 2–5 s, but requires server support and iOS 14+. WebRTC solves the problem radically but is harder to scale.

Audio/video synchronization. When encoding on a mobile device, it is important to set GOP size and bitrate. In our project on Android, we used MediaCodec with a fixed GOP=2 and bitrate of 2 Mbps — this gave a stable picture even when speed dropped to 1 Mbps.

Media server scaling. One Wowza server handles up to 1000 connections. For 10,000 viewers, we configured a cluster of 4 nodes with load balancing via AWS ALB. Cloudflare Stream removes this pain but is more expensive.

How We Do It: Stack and Configurations

We start with an audit of requirements: target latency, expected audience, budget. For MVP, choose RTMP → HLS. For production low latency, choose WebRTC + LL-HLS fallback.

iOS streaming. Basic stack: Swift 5.9, HaishinKit (RTMP/SRT/HLS). Example configuration:

let rtmpStream = RTMPStream(connection: RTMPConnection()) rtmpStream.videoSettings = VideoCodecSettings( videoSize: CGSize(width: 1280, height: 720), bitRate: 2_000_000, frameInterval: 2, frameRate: 30 ) rtmpStream.audioSettings = AudioCodecSettings(bitRate: 128_000) 

Android streaming. Streampack or custom code on CameraX + MediaCodec + RTMP client.

val streamer = CameraStreamer(context, enableAudio = true) streamer.configure( AudioConfig(startBitrate = 128_000, sampleRate = 44100, channelConfig = CHANNEL_IN_STEREO), VideoConfig(startBitrate = 2_000_000, resolution = Size(1280, 720), fps = 30) ) 

Media server. Use Wowza Streaming Engine or Ant Media Server. For WebRTC — Ant Media or Janus.

How to Reduce Stream Latency to 500 ms?

Switching to WebRTC is the only way to get latency < 1 s. Key steps:

  1. Deploy a signaling server (e.g., Node.js + Socket.io).
  2. Set up a TURN server (coturn) for NAT traversal.
  3. Choose a media server that supports WHIP ingest (Cloudflare Stream, Ant Media 2.x).
  4. On the mobile client, use WebRTC.org SDK (Google for Android, native for iOS).

For mass viewing (1000+ viewers), WebRTC overloads the server — use an SFU (Selective Forwarding Unit). Ant Media and Janus support SFU. Source: WebRTC

Why WebRTC Is Not Always Suitable for Mass Broadcasts?

WebRTC requires a persistent P2P connection or SFU. Each viewer consumes about 2 Mbps downstream. For 10,000 viewers, you need 20 Gbps — expensive. Alternative: transcode the stream to HLS on the server and distribute via CDN. This increases latency but saves resources. We use a hybrid scheme: interactive scenarios (voting) via WebRTC for a small group, mass viewing via HLS.

Protocol Comparison

Technology Latency Scalability Complexity Recommendation
RTMP → HLS 15–30 s High Low For recordings and non-interactive broadcasts
RTMP → LL-HLS 2–5 s High Medium Compromise if iOS 14+
SRT → HLS 10–20 s High Medium For unstable networks
WebRTC (SFU) < 500 ms Medium High For interactivity and small groups
RTMP → RTMP 1–5 s Low Low Only for streamers (single viewer)

Media Server Comparison

Server Protocols Scaling Cost
Wowza RTMP, HLS, LL-HLS Cluster up to 10 nodes Commercial license
Ant Media WebRTC, RTMP, HLS Built-in cluster, SFU Free (Community)
Janus WebRTC SFU, sharding Open source

Process

  1. Analytics — measure latency requirements, audience size, device types. Determine protocol and server.
  2. Design — client-server architecture, stream flow, media server configuration.
  3. Implementation — write code in Swift/Kotlin/Flutter, configure server, test on real devices.
  4. Testing — load testing (up to 10,000 virtual viewers) and network testing (3G, 4G, Wi-Fi).
  5. Deployment — CI/CD, monitoring (Prometheus + Grafana), documentation.

What's Included

  • Audit of the current app and architecture selection.
  • Streaming integration on one platform (iOS or Android) with RTMP.
  • Media server deployment (Wowza or Ant Media).
  • WebSocket/Firebase chat with basic moderation.
  • Load testing and optimization.
  • Instructions for developers and administrators.

Estimated Timeline

  • MVP (one protocol, one platform, no chat) — 2–3 weeks.
  • Full system (two platforms, LL-HLS/WebRTC, chat, recording) — 2–3 months.

The cost is calculated individually after the audit. Contact us for an accurate quote.

Typical Mistakes

  • Using HLS for interactivity — latency kills UX.
  • Not setting GOP — packet loss causes artifacts.
  • Forgetting the TURN server for WebRTC — clients behind NAT won't connect.
  • Skimping on the media server — as audience grows, everything crashes.
Production ArchitectureClient (iOS/Android) → RTMP/WHIP → Ant Media Server → transcoding to LL-HLS/WebRTC → CDN (Cloudfront) → viewers. Chat: WebSocket server on Go + Redis for scaling.

Contact us for a consultation — we will select the optimal solution for your budget and timeline. We guarantee stable operation even under peak loads.