LiveKit Swift Client SDK Documentation

Class Local​Video​Track

@objc
public class LocalVideoTrack: Track, LocalTrack, VideoTrack  
%7 LocalVideoTrack LocalVideoTrack Track Track LocalVideoTrack->Track LocalTrack LocalTrack LocalVideoTrack->LocalTrack VideoTrack VideoTrack LocalVideoTrack->VideoTrack

Superclass

Track

Conforms To

LocalTrack
VideoTrack

Properties

capturer

@objc
    public internal(set) var capturer: VideoCapturer

video​Source

@objc
    public internal(set) var videoSource: RTCVideoSource

publish​Options

public var publishOptions: PublishOptions?  

publish​State

public var publishState: Track.PublishState  

Methods

create​Broadcast​Screen​Capturer​Track(name:​source:​options:​)

public static func createBroadcastScreenCapturerTrack(name: String = Track.screenShareVideoName,
                                                          source: VideoTrack.Source = .screenShareVideo,
                                                          options: ScreenShareCaptureOptions = ScreenShareCaptureOptions()) -> LocalVideoTrack  

Creates a track that captures screen capture from a broadcast upload extension

create​Buffer​Track(name:​source:​options:​)

public static func createBufferTrack(name: String = Track.screenShareVideoName,
                                         source: VideoTrack.Source = .screenShareVideo,
                                         options: BufferCaptureOptions = BufferCaptureOptions()) -> LocalVideoTrack  

Creates a track that can directly capture CVPixelBuffer or CMSampleBuffer for convienience

create​Camera​Track()

@objc
    public static func createCameraTrack() -> LocalVideoTrack  

create​Camera​Track(name:​options:​)

@objc
    public static func createCameraTrack(name: String? = nil,
                                         options: CameraCaptureOptions? = nil) -> LocalVideoTrack  

create​InApp​Screen​Share​Track(name:​options:​)

@available(macOS 11.0, iOS 11.0, *)
    public static func createInAppScreenShareTrack(name: String = Track.screenShareVideoName,
                                                   options: ScreenShareCaptureOptions = ScreenShareCaptureOptions()) -> LocalVideoTrack  

Creates a track that captures in-app screen only (due to limitation of ReplayKit)

create​Mac​OSScreen​Share​Track(name:​source:​options:​preferred​Method:​)

@available(*, deprecated, message: "Use new API with MacOSScreenShareSource")
    public static func createMacOSScreenShareTrack(name: String = Track.screenShareVideoName,
                                                   source: ScreenShareSource = .mainDisplay,
                                                   options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
                                                   preferredMethod: MacOSScreenCapturePreferredMethod = .auto) -> LocalVideoTrack  

Creates a track that captures the whole desktop screen

create​Mac​OSScreen​Share​Track(name:​source:​options:​preferred​Method:​)

@objc
    public static func createMacOSScreenShareTrack(name: String = Track.screenShareVideoName,
                                                   source: MacOSScreenCaptureSource,
                                                   options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
                                                   preferredMethod: MacOSScreenCapturePreferredMethod = .auto) -> LocalVideoTrack  

mute()

public func mute() -> Promise<Void>.ObjCPromise<NSNull>  

unmute()

public func unmute() -> Promise<Void>.ObjCPromise<NSNull>  

start()

override public func start() -> Promise<Bool>  

stop()

override public func stop() -> Promise<Bool>  

add(video​Renderer:​)

public func add(videoRenderer: VideoRenderer)  

remove(video​Renderer:​)

public func remove(videoRenderer: VideoRenderer)  

restart​Track(options:​)

@available(*, deprecated, message: "Use CameraCapturer's methods instead to switch cameras")
    public func restartTrack(options: CameraCaptureOptions = CameraCaptureOptions()) -> Promise<Bool>