-
-
Notifications
You must be signed in to change notification settings - Fork 618
Moving from 0.11.x APIs to 1.0.0
shogo4405 edited this page Sep 29, 2019
·
5 revisions
var rtmpStream = RTMPStream(connection: rtmpConnection)
rtmpStream.captureSettings = [
"fps": 30, // FPS
"sessionPreset": AVCaptureSession.Preset.medium.rawValue, // input video width/height
"continuousAutofocus": false, // use camera autofocus mode
"continuousExposure": false, // use camera exposure mode
// .preferredVideoStabilizationMode: AVCaptureVideoStabilizationMode.auto
]
rtmpStream.audioSettings = [
"muted": false, // mute audio
"bitrate": 32 * 1000,
"sampleRate": sampleRate,
]
rtmpStream.videoSettings = [
"width": 640, // video output width
"height": 360, // video output height
"bitrate": 160 * 1000, // video output bitrate
"profileLevel": kVTProfileLevel_H264_Baseline_3_1, // H264 Profile require "import VideoToolbox"
"maxKeyFrameIntervalDuration": 2, // key frame / sec
]
var rtmpStream = RTMPStream(connection: rtmpConnection)
rtmpStream.captureSettings = [
.fps: 30, // FPS
.sessionPreset: AVCaptureSession.Preset.medium, // input video width/height
.continuousAutofocus: false, // use camera autofocus mode
.continuousExposure: false, // use camera exposure mode
// .preferredVideoStabilizationMode: AVCaptureVideoStabilizationMode.auto
]
rtmpStream.audioSettings = [
.muted: false, // mute audio
.bitrate: 32 * 1000,
.sampleRate: sampleRate,
]
rtmpStream.videoSettings = [
.width: 640, // video output width
.height: 360, // video output height
.bitrate: 160 * 1000, // video output bitrate
.profileLevel: kVTProfileLevel_H264_Baseline_3_1, // H264 Profile require "import VideoToolbox"
.maxKeyFrameIntervalDuration: 2, // key frame / sec
]
rtmpConnection.addEventListener(Event.RTMP_STATUS, selector: #selector(rtmpStatusHandler), observer: self)
rtmpConnection.addEventListener(.rtmpStatus, selector: #selector(rtmpStatusHandler), observer: self)
var rtmpStream = RTMPStream(connection: rtmpConnection)
rtmpStream.asyncOrientation = true
var rtmpStream = RTMPStream(connection: rtmpConnection)
if let orientation = DeviceUtil.videoOrientation(by: UIApplication.shared.statusBarOrientation) {
rtmpStream.orientation = orientation
}
NotificationCenter.default.addObserver(self, selector: #selector(on(_:)), name: UIDevice.orientationDidChangeNotification, object: nil)
@objc
private func on(_ notification: Notification) {
guard let orientation = DeviceUtil.videoOrientation(by: UIApplication.shared.statusBarOrientation) else {
return
}
rtmpStream.orientation = orientation
}
HaishinKit.swift | 🇬🇧 HaishinKit.kt | 🇯🇵 Zenn