SKWCustomFrameVideoSource
Objective-C
@interface SKWCustomFrameVideoSource : SKWVideoSource
Swift
class CustomFrameVideoSource : VideoSource
画像フレームの映像入力ソース
CMSampleBufferの画像フレームをループ内からアップデートして描画を行います。
ReplayKitと組み合わせることでアプリの画面をソースにして画面共有が行えます。
let source: CustomFrameVideoSource = .init()
RPScreenRecorder.shared().startCapture { buffer, _, err in
guard err == nil else {
return
}
source.updateFrame(with: buffer)
} completionHandler: { _ in }
let stream = source.createStream()
-
Undocumented
Declaration
Objective-C
- (id _Nonnull)init;Swift
init() -
画像のサンプルバッファを更新します。
Declaration
Objective-C
- (void)updateFrameWithSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;Swift
func updateFrame(with sampleBuffer: CMSampleBuffer)Parameters
sampleBuffer更新する画像フレームのサンプルバッファ
-
Streamを作成します。
Streamの作成後にキャプチャ開始でも機能します。
Declaration
Objective-C
- (SKWLocalVideoStream *_Nonnull)createStream;Swift
func createStream() -> SKWLocalVideoStream