AVPlayer with DocumentBrowserView - ios

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

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

Unable to play firebase video on my iOS device

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.

IOS - How to write AVAsset to file?

I am working with an app now that streams data from a web url. I am able to implement the streaming using AVAsset and AVPlayer as its player. Now, what I want to do is to save the streamed bytes from AVAsset to a music file in local. It's basically writing AvAsset to a music file. What I have in mind is converting AVAsset to NSData but I think this one is not possible.
How can I achieve this? Is this possible?

Play media while downloading

I use an NSURLConnection to get a media file downloaded. While downloading I store the content at a NEMutableData and write it down to a cache file.
Now I want to play this file while downloading with AVPlayer (Not AVAudioPlayer) because it could be video.
At the time the AVPlayer get the URL to the cache file it looks like the player copy the state of the file because the player don't get any changes and after a few seconds it holds because of the end of data.
Does anybody has a better solution but to download everything first until start playing, or is there a way to give the AVPlayer an Internet NSURL and preload the rest while streaming?

play media from download in progress

i'm using AFNetworking to download media files. Audio and Video. I use AFDownloadRequestOperation to get a better way to pause and resume large downloads.
i found lots of tutorials for download and for stream media but i need a way to start download and play the unfinished download from disk to get a better experience while playing large files.
does anybody know how to do this?
As Player i use AVPlayer with AVPlayerItem and AVAsset
if there is another way without this 3 Objects it would be great.

Resources