// Control how video fits within the viewvideoView.layoutMode = .fill // .fill or .fit// Mirror video if neededvideoView.mirrorMode = .auto // .auto, .mirror, or .off
import AVFoundation// Check for available cameraslet devices = try await CameraCapturer.captureDevices()if !devices.isEmpty { // External camera is available let options = CameraCaptureOptions( dimensions: .h720_169, fps: 30 ) try await room.localParticipant.setCamera( enabled: true, captureOptions: options )} else { print("No camera devices available on tvOS")}
Similar to iOS 16+, tvOS 17+ supports multitasking camera access:
if let cameraCapturer = cameraTrack?.capturer as? CameraCapturer { if cameraCapturer.isMultitaskingAccessSupported { cameraCapturer.isMultitaskingAccessEnabled = true }}
See CameraCapturer.swift:52 for implementation details.
Receiving and playing audio works normally on tvOS:
// Audio tracks are automatically played when subscribedfunc room(_: Room, participant: RemoteParticipant, didSubscribeTrack publication: RemoteTrackPublication) { if publication.kind == .audio { print("Subscribed to audio track: \(publication.sid)") // Audio will play automatically }}
<key>NSCameraUsageDescription</key><string>This app needs camera access for video calls</string><key>NSMicrophoneUsageDescription</key><string>This app needs microphone access for audio calls</string>
# Build for tvOS Simulatorxcodebuild build -scheme LiveKit -destination 'platform=tvOS Simulator'# Run testsxcodebuild test -scheme LiveKit -only-testing LiveKitCoreTests -destination 'platform=tvOS Simulator'# List available simulatorsxcrun simctl list devices tvOS
VideoView must be accessed from the main thread on tvOS.
// Correct: Update VideoView on main threadDispatchQueue.main.async { videoView.track = track}// Or use MainActorTask { @MainActor in videoView.track = track}