Live captions - SwiftUI
In SwiftUI, AVPlayer
has built-in support for live video with captions. Users can automatically turn on captions via System Preferences. The easiest way to stream a live video is through VideoPlayer
view.
guard let url = URL(string: "https://appt.org/live-video") else {
return
}
let player = AVPlayer(url: url)
VideoPlayer(player: player)
// for a player on fullscreen
.edgesIgnoringSafeArea(.all)
.onAppear {
player.play()
}