Home > Mobile >  Xamarin Community Toolkit MediaElement not showing an Playback controls or play the video in the sou
Xamarin Community Toolkit MediaElement not showing an Playback controls or play the video in the sou

Time:09-28

Updated - This issue only happens on UWP - Works fine on Android haven't tested it on IOS. I would assume it would work just as fine. The issue is with Xamarin.Community.Toolkit not working with UWP

I've just started learning Xamarin for App development. I'm mostly running UWP for testing as emulators slow down my machine. After researching the best tool to play videos using Xamarin I found the Xamarin Community Toolkit. Followed the basic steps required to get MediaElement on screen and added basic properties to it.

I got the Xamarin tutorial basic video used in a tutorial inside the source. I know it works because you can copy the link and paste it into a browser and you'll get it playing.

After messing around with different versions I can't get this to work. No controls want to show up either nor the video itself. I have run out of ideas please someone HELP.

Running a blank template for this practice Hello World Project.
Using all of the latest versions possible. Project was created 20/09/2022 So I would assume everything latest version.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="HelloWorldXamarin.MainPage"
             Title="This is a Hello World Practice Project">

<xct:MediaElement Source="https://sec.ch9.ms/ch9/5d93/a1eab4bf-3288-4faf-81c4-294402a85d93/XamarinShow_mid.mp4" 
                          BackgroundColor="LightBlue" 
                          HeightRequest="300"
                          VerticalOptions="FillAndExpand"
                          ShowsPlaybackControls="True"
                          AutoPlay="True"/>

This is what I get on my screen.

enter image description here

CodePudding user response:

Unfortunately, the situation you describe is actually a bug for UWP, and you can check this link.

By the way, I test the code you provided. But It doesn't matter which version I change Xamarin Community Toolkit to.

  • Related