VideoSurface
Written by
Updated at November 5, 2026
public final class VideoSurface: UIView
UIView for displaying videos.
Contents
This page displays:
Description
Add VideoSurface to the view hierarchy and attach a YaPlayer instance to the component. The video display area automatically resizes to match the bounds value.
To use VideoSurface in SwiftUI, wrap it in UIViewRepresentable.
Inheritance
The class is inherited from UIView.
Notes
To add a ready-made player shell, use VideoView from the CloudVideoPlayerUI library.
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.
Return value: PictureInPictureController instance or nil if your device does not support PiP.
public func attach(player: YaPlayer)
Attaches the player to the video display surface.
Parameters:
player: Player instance whose video you want to display.
Examples
let surface = VideoSurface()
view.addSubview(surface)
surface.frame = UIScreen.main.bounds
surface.attach(player: player)