Skip to content

About

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.

Topics

Resources

Code of conduct

Stars

3.1k stars

Watchers

64 watching

Forks

Repository files navigation

📡 HaishinKit for iOS, macOS, tvOS, visionOS and Android.

GitHub Stars Release Platform Compatibility Swift Compatibility GitHub license GitHub Sponsor

A Swift SDK for capturing, composing, publishing, and playing live audio and video on iOS, macOS, tvOS, and visionOS. In development since 2015.

💖 Sponsors

See the support guide for bug reports, questions, and paid development. GitHub Sponsors lists current sponsorship benefits and helps fund maintenance and streaming compatibility testing.

Start here: stream from an iPhone over RTMPS

  1. Check your setup. HaishinKit 2.3.x requires iOS 15 or later and Xcode 26 or later. See the requirements for other platforms and versions.
  2. Try the iOS example. Check out release 2.3.2, open Examples/Examples.xcworkspace, and run the Example iOS scheme on an iPhone running iOS 16 or later. If Xcode reports a signing error, choose your own team and a unique bundle identifier in Signing & Capabilities. In the example, enter your provider's rtmps:// ingest URL in URL and the stream key in Name. If the URL already includes the key, leave Name empty.
  3. Add it to your app. Use Swift Package Manager and add the HaishinKit and RTMPHaishinKit products to your app target. See the RTMP publish example for 2.3.2 and the camera and microphone prerequisites.

What has been tested? The streaming compatibility report records the SDK revision, test setup, and whether the receiver decoded video and audio. The Cloudflare Stream RTMPS-to-HLS result comes from a short macOS test, not an iPhone test or a reconnect test.

🎨 Features

  • Optional AV1 codec (development): AOMHaishinKit offers standalone software encoding/decoding and encoder statistics. Register its factory for Enhanced RTMP publishing and software playback fallback (8-bit SDR).
  • Protocols ✨Publish and playback feature are available RTMP, SRT and WHEP/WHIP(alpha).
  • Multi Camera access ✨Support multitasking camera access.
  • Multi Streaming ✨Allowing live streaming to separate services. Views also support this, enabling the verification of raw video data.
  • Strict Concurrency ✨Supports Swift's Strict Concurrency compliance.
  • Optional codecs (development) VPXHaishinKit provides software VP8/VP9 conversion and registered Enhanced RTMP publishing/playback (8-bit SDR).
  • Screen Capture ✨Supports ReplayKit(iOS) and ScreenCaptureKit(macOS) api.
  • Video mixing ✨Possible to display any text or bitmap on a video during broadcasting or viewing. This allows for various applications such as watermarking and time display.

🌏 Requirements

Development

Version Xcode Swift
2.3.0+ 26.0+ 6.0+
2.2.x 26.0+ 6.0+
2.1.x 16.4+ 6.0+

The package declares Swift tools version 6.0. The review and release workflows on main use the repository’s pinned Xcode version.

OS

Version iOS tvOS Mac Catalyst macOS visionOS watchOS
2.3.0+ 15.0+ 15.0+ 15.0+ 12.0+ 1.3+ -
2.2.x 15.0+ 15.0+ 15.0+ 12.0+ 1.0+ -
  • The libsrt 1.5.7 dependency includes arm64 Mac Catalyst support. HaishinKit currently has a separate Mac Catalyst build issue in TextScreenObject.swift (NSColor is unavailable).

📖 Getting Started

Important

There are several issues that occur when connected to Xcode. Please also refer to this document.

🔧 Examples

  • Reference implementation app for live streaming publish and playback.
  • If an issue occurs, please check whether it also happens in the examples app.
  • System codec inspector: VideoToolbox and AudioConverter reports in the iOS, macOS, tvOS and visionOS samples.
  • Apple TV studio: Bonjour SRT send/receive, test signals, and Continuity Camera (tvOS 17+).

The macOS example below publishes a test-signal ScreenObject and receives it over SRT, without a camera.

Publish (macOS) Playback (macOS)
macOS Publish showing a test-signal ScreenObject, scene controls, and MediaMixer settings during SRT streaming macOS Playback receiving the test signal over SRT with receive statistics

🧭 Run

Open the workspace and select an Example target. Use its connection settings where available; shared development defaults are in Examples/Preference.swift.

📥 Download

git clone https://github.com/HaishinKit/HaishinKit.swift.git
cd HaishinKit.swift
open Examples/Examples.xcworkspace

🔧 Installation

Using Swift Package Manager

https://github.com/HaishinKit/HaishinKit.swift

🔧 Prerequisites

AVAudioSession

Make sure you setup and activate your AVAudioSession iOS.

import AVFoundation

let session = AVAudioSession.sharedInstance()
do {
    try session.setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker, .allowBluetooth])
    try session.setActive(true)
} catch {
    print(error)
}

🔧 Cocoa Keys

Please make sure to contains Info.plist the following values when accessing the camera or microphone.

<key>NSCameraUsageDescription</key>
<string>your usage description here</string>
<key>NSMicrophoneUsageDescription</key>
<string>your usage description here</string>

📃 Documentation

🌏 Related projects

Project name Notes License
HaishinKit for Android. Camera and Microphone streaming library via RTMP for Android. BSD 3-Clause "New" or "Revised" License
HaishinKit for Flutter. Camera and Microphone streaming library via RTMP for Flutter. BSD 3-Clause "New" or "Revised" License

📜 License

BSD-3-Clause

About

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.

Topics

Resources

Code of conduct

Stars

3.1k stars

Watchers

64 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages