Can Airplay only play remote videos? Is it possible to play local video files on iPhone?
let player = AVQueuePlayer()
// let url = fileURLOnIPhone // can not airplay, no video, no audio
let url = URL(string: "https://xxxxxx.mp4")! // can be airplay with video and audio
let asset = AVAsset(url: url)
let playerItem = AVPlayerItem(asset: asset)
player.insert(playerItem, after: nil)
let vc = AVPlayerViewController()
vc.player = player
present(vc, animated: true) {
player.play()
}