- Camera and Microphone streaming library via SRT for iOS.
- This project status is working in progress.
- Publish and Recording (H264/AAC)
- Playback
- mode
- caller
- listener
- rendezvous
| - | HKView | GLHKView | MTHKView |
|---|---|---|---|
| Engine | AVCaptureVideoPreviewLayer | OpenGL ES | Metal |
| Publish | ○ | ○ | ◯ |
| VIsualEffect | × | ○ | ◯ |
| Condition | Stable | Stable | Beta |
| - | iOS | OSX | tvOS | XCode | Swift | CocoaPods | Carthage |
|---|---|---|---|---|---|---|---|
| 0.0.0+ | 8.0+ | 10.11+ | - | 10.0+ | 4.2 | 1.5.0+ | 0.29.0+ |
Not available.
- CocoaPods
- Swift Package Manager
github "shogo4405/SRTHaishinKit.swift" "0.0.4"Please contains Info.plist.
iOS 10.0+
- NSMicrophoneUsageDescription
- NSCameraUsageDescription
Make sure you setup and activate your AVAudioSession.
import AVFoundation
let session: AVAudioSession = AVAudioSession.sharedInstance()
do {
try session.setPreferredSampleRate(44_100)
// https://stackoverflow.com/questions/51010390/avaudiosession-setcategory-swift-4-2-ios-12-play-sound-on-silent
if #available(iOS 10.0, *) {
try session.setCategory(.playAndRecord, mode: .default, options: [.allowBluetooth])
} else {
session.perform(NSSelectorFromString("setCategory:withOptions:error:"), with: AVAudioSession.Category.playAndRecord, with: [AVAudioSession.CategoryOptions.allowBluetooth])
}
try session.setMode(AVAudioSessionModeDefault)
try session.setActive(true)
} catch {
}let srtConnection: SRTConnection = SRTConnection()
let srtStream: SRTStream = SRTStream(connection: srtConnection)
srtStream.attachCamera(DeviceUtil.device(withPosition: .back))
srtStream.attachAudio(AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeAudio))
srtStream.publish("hello")
srtConnection.connect("srt://host:port?option=foo")
var hkView: HKView = HKView(frame: view.bounds)
hkView.attachStream(srtStream)
// add ViewController#view
view.addSubview(hkView)SRTHaishinKit needs other dependencies. Please build.
brew install cmakecarthage update --use-xcframeworks --platform iOSffplay -analyzeduration 100 -i 'srt://${YOUR_IP_ADDRESS}?mode=listener'BSD-3-Clause