Forum

PureSourceCode.com Forum
Share:
Notifications
Clear all

How to Play Youtube Video in Xamarin Forms?

3 Posts
2 Users
0 Likes
3,942 Views
(@enrico)
Member Admin
Joined: 4 years ago
Posts: 151
Topic starter  

In my app I want to create a list of video I have published on YouTube. I saw the common answer is to use a WebView. Then, I created the following code:

<WebView Source="{Binding VideoUrl}" 
         HorizontalOptions="Fill" VerticalOptions="Fill"
         IsVisible="{Binding ShowVideo}" />

It is ok is I use the share url like this one  https://youtu.be/rAGh8iy9YnU  but I see the entirely YouTube page. I want to display only the video and, if it is possible, some easy controls for play and stop.

I tried to use the embedded link from YouTube (like  https://www.youtube.com/embed/rAGh8iy9YnU ).

I can see the preview image but the video doesn't play and an error is displayed: "Video unavailable".


   
Quote
(@nickbonz)
New Member
Joined: 3 years ago
Posts: 1
 

The videos that were displaying this on embed had "Copyrighted" music playing in the background. YouTube apparently does not play videos like this while embedded. We had our user remove the audio and re-uploaded the video and everything is working fine now.

http://net-informations.com/q/mis/youtube.html


   
ReplyQuote
(@enrico)
Member Admin
Joined: 4 years ago
Posts: 151
Topic starter  
Quote from nickbonz on September 7, 2021, 8:11 am

The videos that were displaying this on embed had "Copyrighted" music playing in the background. YouTube apparently does not play videos like this while embedded. We had our user remove the audio and re-uploaded the video and everything is working fine now.

http://net-informations.com/q/mis/youtube.html

The video is hosted in YouTube, whatever YouTube streams the app shows. You can avoid this issue if you embed the video in the app or using another streaming service like Vimeo.


   
ReplyQuote
Share: