On macOS Sonoma I have a SwiftUI app that correctly plays remote video files and local video files from the app bundle.
Where I'm having trouble is setting up the AVPlayer URL for a UVC camera device directly connected on the Mac.
let url = URL(string: "https://some-remote-video.mp4")!
player = AVPlayer(url: url)
player.play()
Is there some magic to using a UVC device with AVPlayer, or do I need to access the UVC device differently?
Thanks, Grahm
take a look at the AVCam sample code. It is for iOS, but most of it translates pretty well to macOS. You build a AVCaptureSession using your AVCaptureDevice, and set up a AVCapturePreviewLayer so you can see what it is producing. There is also older sample code kicking around which is more Mac-oriented, and some third-party samples on GitHub. Try searching for "macOS AVCaptureSession sample"