VideoSurface
Written by
Updated at May 28, 2026
public final class VideoSurface: UIView
UIView component for displaying videos.
Contents
Discussion
Add VideoSurface to the view hierarchy and attach a YaPlayer instance to the component. The surface automatically scales to fit its bounds.
To use VideoSurface in SwiftUI, wrap it in UIViewRepresentable.
Inheritance
UIView
Notes
If you need a built-in player skin, use VideoView from CloudVideoPlayerUI.
Initializers
public init()
Creates a surface for the video.
Methods
public func reset()
Disconnects the player from the surface.
public func getPipController() -> PictureInPictureController?
Returns the Picture-in-Picture (PiP) mode controller, if available.
Returns: PictureInPictureController instance, or nil if the device does not support PiP.
Examples
let surface = VideoSurface()
view.addSubview(surface)
surface.frame = UIScreen.main.bounds
surface.attach(player: player)