PlanetKitMTKView
public class PlanetKitMTKView : MTKView
extension PlanetKitMTKView: PlanetKitVideoOutputDelegate
A custom MetalKit view for rendering PlanetKit scenes.
This view subclass provides additional functionality for rendering PlanetKit scenes using Metal.
It inherits from MTKView
and adds a delegate property for receiving draw events.
-
Sets the delegate to receive draw events.
Note
The delegate is weakly referenced to avoid retain cycles.Declaration
Swift
@objc public weak var drawDelegate: PlanetKitMTKViewDelegate? { get set }
-
If the first frame of video is rendered, the
isFirstFrameDrawn
will returntrue
.Declaration
Swift
@objc public internal(set) var isFirstFrameDrawn: Bool { get set }
-
If you want to change rotation of video, set rotation with
PlanetKitVideoRotation
integer type value.Remark
The default value is.rotation0
.Declaration
Swift
@objc public var rotation: PlanetKitVideoRotation { get set }
-
-
Represents the mirrored state applied when the video is displayed.
Remark
The default value is.auto
.Declaration
Swift
@objc public var mirroredType: PlanetKitMirroredType { get set }
-
Sets the rendering algorithm.
Remark
The default value is.doubleBuffering
and we do not recommend changing this value.Declaration
Swift
@objc public let renderingPolicy: PlanetKitRenderingPolicy
-
Initializes a new
PlanetKitMTKView
instance with the specified frame and device.Declaration
Swift
public override init(frame: CGRect, device: MTLDevice?)
Parameters
frame
The frame rectangle for the view, measured in points.
device
The Metal device to use for rendering.
-
Initializes a new
PlanetKitMTKView
instance with the specified frame, device, and rendering policy.Declaration
Swift
@objc public init(frame: CGRect, device: MTLDevice?, renderingPolicy: PlanetKitRenderingPolicy)
-
Clears the current video frame.
Remark
This method is useful when you want to clear the video frame.Declaration
Swift
@objc public func clear()
-
Declaration
Swift
public func videoOutput(_ videoBuffer: PlanetKitVideoBuffer)
-
Declaration
Swift
@objc public static var isMetalAvailable: Bool { get }