Reputation: 8381
I have one simple application which is loading videos list from firebase and by click on any of the video I will load that video through AVPlayer
.
But I am unable to play any video uploaded at Firebase storage.
Player Code :
func displayVideo(_ videoURL:URL){
let player = AVPlayer(url: videoURL as URL)
self.playerController.player = player
self.addChildViewController(self.playerController)
self.view.addSubview(self.playerController.view)
self.playerController.view.frame = self.view.frame
player.play()
}
Also, I tried another alternate solution by download this video locally and play it from local but that one also not working.
let me know if I am doing any mistake in the video player.
Upvotes: 1
Views: 1744
Reputation: 8381
Guys no problem in my player code as I have test another video like test.mov file and its working in both solution.
So I found one answer here which help me to test my video formate.
Answer by Mike McDonald:
I have a feeling that the issue here is that the video is not in the correct format (needs to be H.264 or MPEG-4 in .mp4, .m4v, .mov [or an HLS video for live streaming]), and the content type should be set appropriately (video/mp4, video/x-m4v, video/quicktime). Can you confirm these?
Still for my satisfaction I have tried this video on Mac quick time player and got below error.
Than I realised that some time due to video formate we unable to play or stream video.
Thanks every one who helped here.
This answer is for whom who is facing same issue like me.
Upvotes: 1