BackgroundReplacementVideoFrameProcessor
@objcMembers
public class BackgroundReplacementVideoFrameProcessor : NSObject, VideoSource, VideoSink
BackgroundReplacementVideoFrameProcessor
is a processor which receives video frames via VideoSource
and then creates the foreground image which is rendered on top of a background image.
-
Declaration
Swift
public var videoContentHint: VideoContentHint
-
Public constructor to initialize the processor with a
BackgroundReplacementConfiguration
.Declaration
Swift
public init(backgroundReplacementConfiguration: BackgroundReplacementConfiguration)
Parameters
backgroundReplacementConfiguration
-
Receive a video frame from some upstream source. The foreground is segmented and then masked on top of the background replacement image.
Declaration
Swift
public func onVideoFrameReceived(frame: VideoFrame)
Parameters
frame
New video frame to consume.
-
Allow builders to change background image after initialization.
Declaration
Swift
public func setBackgroundImage(newBackgroundReplacementImage: UIImage)
Parameters
newBackgroundReplacementImage
New background replacement image.
-
Adds a video sink to the sinks set.
Declaration
Swift
public func addVideoSink(sink: VideoSink)
-
Remove a video sink from the sinks set.
Declaration
Swift
public func removeVideoSink(sink: VideoSink)
-
Update the
VideoSink(s)
with a new frame.Declaration
Swift
public func updateSinks(frame: VideoFrame)
Parameters
frame
Next frame to render.