how to download a video from url in xamarin forms

2.6k views Asked by At

Actually i'm developing a app with the visual studio by plugin xamarin forms for all 3 platform ,searched a lot to download a image,video,file from the url but didn't get clear idea.

If anyone have idea about this please help me out.

2

There are 2 answers

1
Mike James On

Downloading the video can be achieved very easily using standard .Net conventions. I've linked to the MSDN Docs on the Stream class which will probably prove useful in fetching the video.

https://msdn.microsoft.com/en-us/library/system.io.stream(v=vs.110).aspx

As for how you would display the video. Xamarin.Forms doesn't have a video player so you'll need to create a custom renderer for this. The following forum post should help you with this.

https://forums.xamarin.com/discussion/23931/android-video-player-using-xamarin-forms

0
Adam On

If you don't want to worry about learning the APIs for all three platforms to expose video playback, you might want to check out the Xamarin Component Store. I recently released a cross-platform Xamarin Forms video player that renders the native video player for iOS, Android, and Windows Phone. It allows you to control playback, respond to events (playing, paused, completed, etc.) all from shared code.

https://github.com/adamfisher/Xamarin.Forms.VideoPlayer

You simply drop in a single line as shown and off you go:

<o:VideoPlayer Source="http://vjs.zencdn.net/v/oceans.mp4" />

Disclaimer: This is my component.