コード
override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { if let orientationAttachment = CMGetAttachment(sampleBuffer, key: RPVideoSampleOrientationKey as CFString, attachmentModeOut: nil) as? NSNumber { if let orientation = CGImagePropertyOrientation(rawValue: orientationAttachment.uint32Value) { // orientationを使った処理 } } }
補足情報
- RPVideoSampleOrientationKey - ReplayKit | Apple Developer Documentation に書いてあるとおりiOS11以降でないと使えない
- また、https://blog.csdn.net/linpeng_1/article/details/83582521 にある様に
Link Binary With Libraries
からReplaykit.frameworkのRequestをOptionにする必要がある。- Xcode11からは
Do Not Embed
- Xcode11からは