Contents

haishinkit/haishinkit.swift

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

๐Ÿ’– Sponsors

Do you need additional support? Technical support on Issues and Discussions is provided only to contributors and academic researchers of HaishinKit. By becoming a sponsor, I can provide the support you need.

Sponsor: $50 per month: Technical support via GitHub Issues/Discussions with priority response.

๐ŸŽจ Features

  • 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.
  • 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.

|Publish|Playback| |:---:|:---:| |<img width="961" alt="" src="https://github.com/user-attachments/assets/aaf6c06f-d2de-43c1-a435-90907f370977">|<img width="849" alt="" src="https://github.com/user-attachments/assets/0a07b418-aa56-41cb-8e6d-e12596b25ae8">|

๐ŸŒ Requirements

Development

|Version|Xcode|Swift| |:----:|:----:|:----:| |2.2.0+|26.0+|6.0+| |2.1.0+|16.4+|6.0+|

OS

|iOS|tvOS|Mac Catalyst|macOS|visionOS|watchOS| |:-:|:-:|:-:|:-:|:-:|:-:| |15.0+|15.0+|15.0+|12.0+|1.0+|-|

  • SRTHaishinKit is not avaliable for Mac Catalyst.

๐Ÿ“– 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.
Usage

You can verify by changing the URL of the following file. https://github.com/HaishinKit/HaishinKit.swift/blob/abf1883d25d0ba29e1d1d67ea9e3a3b5be61a196/Examples/Preference.swift#L1-L7

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

๐Ÿ”ง 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

๐Ÿ“œ License

BSD-3-Clause

Package Metadata

Repository: haishinkit/haishinkit.swift

Default branch: main

README: README.md