Skip to content

HaishinKit/HaishinKit.swift

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

GitHub Stars Release Platform Compatibility Swift Compatibility GitHub license GitHub Sponsor

  • Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
  • 10th Anniversary🎖️In development for 10 years, with 2,778 commits and 163 releases. Thank you. Since Aug 2, 2015.
  • If you want to support e-mail based communication without GitHub.
    • Consulting fee is $50/1 incident. I'm able to response a few days.

💖 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 accessSupport 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

🌏 Requirements

Development

Version Xcode Swift
2.1.0+ 16.4+ 6.0+

OS

iOS tvOS macOS visionOS Mac Catalyst watchOS
13.0+ 13.0+ 10.15+ 14.0+ 1.0+ -
  • SRTHaishinKit and RTCHaishinKit are not avaliable for Mac Catalyst.

📖 Getting Started

Important

Some Xcode's debug features may be incompatible and could cause crashes. Please read the following issue and turn them off. #1722

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

struct Preference: Sendable {
// Temp
static nonisolated(unsafe) var `default` = Preference()
var uri: String? = "rtmp://192.168.1.6/live"
var streamName: String? = "live"
}

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

🌏 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

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 78

Languages