Reputation: 1990
Am trying to play stream video using, AVPlayerViewController, all other extensions works fine"3GP MP4 ... ", but ".avi" the video start with blank screen.
if let videoURL = URL(string: "http://techslides.com/demos/samples/sample.avi"){
let player = AVPlayer(url: videoURL)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
self.present(playerViewController, animated: true) {
playerViewController.player!.play()
}
}
Upvotes: 2
Views: 1106
Reputation: 5088
Reading AVPlayer docs
An AVPlayer is a controller object used to manage the playback and timing of a media asset. You can use an AVPlayer to play local and remote file-based media, such as QuickTime movies and MP3 audio files
Therefore the video format should be supported by QuickTime
and currently the supported formats by QuickTime list
doesn't contain .avi
therefore a proper solution for this is to use a custom video player.
Upvotes: 2