1

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.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
  • I think you have to look over [here](https://stackoverflow.com/questions/37865482/firebase-storage-video-streaming) . – dahiya_boy Apr 04 '18 at 10:35
  • @dahiya_boy I have already check that question thread but my problem is different please check my answer. Thanks – CodeChanger Apr 04 '18 at 10:37

1 Answers1

1

Guys no problem in my player code as I have test another video like test.mov file and its working in both solution.

  • Live streaming
  • Local file

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.

enter image description here

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.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80