- Camera and Microphone streaming library via SRT for iOS.
- Issuesの言語は、英語か、日本語でお願いします!
- Publish and Recording (H264/AAC)
- Playback
- mode
- caller
- listener
- rendezvous
see also https://github.com/shogo4405/HaishinKit.swift/blob/master/README.md
- | 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+ |
Please contains Info.plist.
iOS 10.0+
- NSMicrophoneUsageDescription
- NSCameraUsageDescription
BSD-3-Clause
Paypal
Bitcoin
1LP7Jo4VwAFdEisJSykBAtUyAusZjozSpw
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)
You can run the ffplay as SRT service.
ffplay -analyzeduration 100 -i 'srt://${YOUR_IP_ADDRESS}?mode=listener'
SRTHaishinKit needs other dependencies. Please build.
carthage update --platform iOS
cd /Vendor/SRT/
./build-openssl-iOS.sh
./build-srt-iOS.sh
carthage update --platform macOS
brew update
brew install srt
Yes. Consulting fee is $50/1 incident. I don't recommend. Please consider to use Issues.