How to play video in video player in xamarin forms?

Published

I am working in xamarin forms. I am trying to play video in Video Player. For the same I have used this sample code from github

https://github.com/xamarin/customer-success-samples/tree/master/samples/Xamarin.Forms/FormsNativeVideoPlayer

but problem is when I put “http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4” link to VideoPlayer_CustomRender.cs file Video is play properly. but when I put any youtube link this is not working and show me the error “Can’t play this video”. I want to achieve this functionality specially in android.

I can’t understand what is happening?

Source: Xamarin.ios Questions

Published
Categorised as Uncategorised Tagged , , , ,

Answers

You can check out the video player component on the Xamarin Forms component store. It allows you to render the native video player on iOS, Android, and Windows Phone.

It also allows you to play YouTube videos using an included XAML extension called YouTubeVideoIdExtension. Note that this is experimental since you should be using the official Google APIs to integrate and get the correct source URLs.

The code snippet below shows the simplest example of just dropping it in and using it. You also have the ability to hook into events like playing, paused, stopped, completed, etc. You can control volume, autoplay, and repeat among other things.

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

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:o="clr-namespace:Octane.Xam.VideoPlayer;assembly=Octane.Xam.VideoPlayer"
             x:Class="VideoPlayerSamples.VideoPlayerBasicExamplePage"
             Title="Basic Video Player">

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

</ContentPage>

Disclaimer: This is my component.


Colby Dicki

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq