Skip to main content
Red5WebRTCKit is the native iOS SDK for publishing and subscribing to live streams over WebRTC. It handles ICE negotiation, codec selection, camera and microphone capture, and license validation so you can focus on building your app. The SDK works with both Red5 Cloud (Stream Manager) deployments and standalone Red5 Pro servers, and is compatible with SwiftUI and UIKit.

Requirements

  • iOS 13.0 or later
  • Xcode 14.0 or later
  • Swift 5.5 or later
  • A valid Red5 Pro SDK license key

Installation

Add the SDK to your Xcode project using Swift Package Manager. Package URL: https://github.com/red5pro/red5pro-ios-sdk Or declare it in your Package.swift:

Permissions

Add the following keys to your Info.plist before publishing. Camera permission is not required for audio-only sessions.

License key setup

Pass your license key to the builder with .setLicenseKey(). The SDK validates the key asynchronously when the client is built, and fires onLicenseValidated on your delegate before any streaming can begin.
Your license key is available on the Dev Resources page in the Red5 Cloud dashboard.

Minimal publish

Publishing requires three steps after the license validates: start a camera preview, then call publish().
1

Build the client

Configure the client with your server details and media settings. Use setStreamManagerHost() for Red5 Cloud or setServerIp() for a standalone server.
2

Wait for license validation

The SDK fires onLicenseValidated before any other callback. Start the camera preview only after validation succeeds.
3

Publish when preview is ready

Enable your publish button in onPreviewStarted, then call publish() when the user taps it.
4

Stop the session

Publish lifecycle:

Minimal subscribe

Subscribing does not require a preview step. Build the client, attach a renderer for the incoming video, and call subscribe().
Show the video renderer once the stream arrives:

Audio-only streaming

Set .setVideoEnabled(false) to publish or subscribe without video. No camera permission is required, and no RTCMTLVideoView renderer is needed.
For audio-only publishing, call publish() directly from onLicenseValidated — no preview step is needed:

Custom video settings

Configure resolution, frame rate, and bitrate on the builder before calling .build(). These settings cannot be changed after the client is created.
Recommended presets:
Bitrate is a target, not a guarantee. WebRTC’s congestion control may lower it dynamically if network conditions degrade. To change settings after a session starts, stop and release the client, then rebuild with new parameters.

Camera controls

Call these methods on the client instance any time after startPreview() completes. Switch between front and back camera:
Mute and unmute video:
Mute and unmute audio:
SwiftUI pattern:

Event reference

Implement Red5ProWebrtcEventDelegate in your class to receive SDK lifecycle events. All methods have default no-op implementations, so you only need to override the callbacks you care about.

Configuration reference

Key Red5WebrtcClientBuilder methods:

Example apps

Each example is a self-contained Xcode project. Copy Config.swift and the example file into a fresh project, fill in your server details, and run.
  • 01-MinimalPublish — fewest lines needed to go live
  • 02-MinimalSubscribe — fewest lines needed to receive a stream
  • 03-AudioOnly — publish or subscribe with video disabled
  • 04-CustomVideoSettings — configure resolution, frame rate, and bitrate
  • 05-CameraControls — flip camera, mute/unmute video and audio while live
Browse all examples on GitHub