TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | BSD 3.0 |
ReleasedLast Release | Sep 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by shogo4405.
Depends on: | |
GPUImage | ~> 0.1.7 |
HaishinKit | ~> 0.8.0 |
GPUImage + HaishinKit(lf). Camera and Microphone streaming library via RTMP, HLS for iOS.
- | iOS | XCode | Swift | CocoaPods | Carthage |
---|---|---|---|---|---|
1.2.0 | 8.0+ | 8.3+ | 4.0 | 1.2.0 | 0.20.0+ |
1.1.0 | 8.0+ | 8.3+ | 3.1 | 1.2.0 | 0.20.0+ |
iOS10.0+
New BSD
Bitcoin
1CWA9muX36QKBdJiRQJGpu2HvchfEpJbWr
// must import HaishinKit and GPUHaishinKit
import HaishinKit
import GPUHaishinKit
import GPUImage
class ViewController: UIViewController {
@IBOutlet weak var outputView: GPUImageView?
var camera:GPUImageVideoCamera?
var filter:GPUImageSepiaFilter?
var rtmpConnection:RTMPConnection?
var rtmpStream:RTMPStream?
var output:GPUImageRawDataOutput!
override func viewDidLoad() {
super.viewDidLoad()
camera = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPreset1280x720, cameraPosition: .back)
rtmpConnection = RTMPConnection()
rtmpStream = RTMPStream(connection: rtmpConnection!)
filter = GPUImageSepiaFilter()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
rtmpStream?.attachGPUImageVideoCamera(camera!)
rtmpStream?.attachAudio(AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeAudio))
rtmpStream?.videoSettings = [
"width": 720,
"height": 1280,
]
camera?.addTarget(filter!)
filter?.addTarget(outputView)
filter?.addTarget(rtmpStream!.rawDataOutput)
camera?.outputImageOrientation = .portrait
camera?.startCapture()
}
override func viewWillDisappear(_ animated: Bool) {
rtmpStream?.close()
rtmpStream?.dispose()
camera?.stopCapture()
super.viewWillDisappear(animated)
}
}