Unable to play firebase video on my iOS device - ios

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.

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.
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.

Related

Play 360 live video stream

I'm using MobileVLCKit for playing the live streamings for a while now, but now I've been tasked to play 360 live video streams I've tried to stream the video normally but it shows rectangular view for overall video what I want is play like 360 videos so the user can interact with the video. The current playback for video is like
Code for playback from MobileVLCKit is below
let url = URL(string: "rtmp://\(streamurl)/LiveApp/022036535502121746572694")
player.media = VLCMedia(url: url!)
player.drawable = self.videoView
player.play()
If anybody has streamed 360 videos please let me know How can I do that?
TIA Any links or suggestions will also be much appreciated.
The latest version of VLC player does support 360 video playback but ti may be that the MobileVLCKit is a subset that does not include this yet - certainly it is not obvious in the documentation that it does.
There is a way you can use the full VLC player from your app, if that works for you as a workaround, by using an 'x-callback-url'.
The iOS VLC documentation contains some instructions for this at the time of writing (https://wiki.videolan.org/Documentation:IOS/) including the specific format below:
vlc-x-callback://x-callback-url/ACTION?url=...&PARAMETER=...
Actions:
stream: VLC plays the stream provided by the URL parameter
download: VLC will download the file provided by the URL parameter
Optional Parameters:
filename: VLC will store the file under the given filename when using the download action.
x-success: VLC will open another x-callback-url once playback is done.
x-error: VLC will open another x-callback-url if playback fails. Requires version >2.5.0 or later
Its also worth noting that the player has to know the video is 360 - the video may indicate this somehow, in its header info typically, or you may find you need to tell the player itself to play the video as 360. It may be worth playing with some online or downloadable demo VR players to get a feel - e.g.:
https://bitmovin.com/demos/vr-360
https://www.jwplayer.com/developers/web-player-demos/360-video/
http://demo.theoplayer.com/vr-and-360

AVPlayer with DocumentBrowserView

Good day.
Someone knows how to transfer the document url to the avplayer if you want to play the video file through DocumentBrowserView
Using documentUrl did not work for me

Apple HLS offline video playing can not play 2 videos if internet not available

I am streaming and download to offline 4 videos simultaneously by using Apple HLS Catelog
I could successfully download the videos.
Then, I am trying to view four videos offline by using 4 AVPlayer instance
let playerItem = AVPlayerItem(asset: (asset.urlAsset))
let player1 = AVPlayer(playerItem: playerItem)
player1.play()
There is a strange behaviour, only first paying video is Playing (All videos are successfully downloaded).This condition remains the same if the videos are interchanged.
This video is reading from an IP-Camera by using my own python application and upload to cloud server.
But, I could successfully play all videos (4 videos) concurrently when using a sample mp4 which is downloaded from internet.
It was my mistake, When download I used different names for each videos, So I could successfully downloaded the vides. But, When playing I was used same asset name for all offline videos. So, It is always playing first video only.

Load Youtube URL & Playing Only The Audio Of A Video File

I was wondering if there was any way to load a YouTube URL like http://www.youtube.com/watch?v=EbJtYqBYCV8 and then only playing only the audio from this video in Xcode.
Thanks!
-Petahwil

iOS AudioStreamer - music not playing in full length

In recent work, I am using Matt Gallagher's AudioStreamer ( downloaded from here ) codes to make a music player in my App.
I have an XML file in my remote server I have hosted. This XML file has song title and songs' URL. My App gets the songs' title and URL and using Matt's AudioStreamer, it plays those songs but the problem is the song does not play in full length. Between 30 second to 1 minute, it stops playing and displays "no audio data found" pop up message.
Has anyone used Matt's API for audio stream (I am using here .mp3 files)?
Can anyone help me to fix this issue ?
Thanks
It could be a corrupt MP3 file - can you provide a link to the MP3 for me to test? I've written a more advanced AudioPlayer inspired by Matt's AudioStreamer (hosted here: https://code.google.com/p/audjustable/). I'd be interested in testing it against your files.

Resources