XamarinCommunityToolkit
XamarinCommunityToolkit copied to clipboard
[Bug] MediaElement for UWP is broken in Xamarin Community Toolkit 1.1
Description
[Bug] MediaElement for UWP is broken in Xamarin Community Toolkit 1.1
Steps to Reproduce
- Try the below MainPage.xaml file that contains a MediaElement Tag (set the UWP project as startup, and start debugging). You will only get the "red background" set in "BackgroundColor" in XAML below, but not the player interface, and playback does not work
<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="ClipM.MainPage">
<xct:MediaElement Source="https://sec.ch9.ms/ch9/5d93/a1eab4bf-3288-4faf-81c4-294402a85d93/XamarinShow_mid.mp4"
ShowsPlaybackControls="True" BackgroundColor="Red"/>
</ContentPage>
(Xamarin Forms version 5.0.0.2012) (Xamarin Community Toolkit version 1.1.0)
Expected Behavior
Playback of Video to start
Actual Behavior
You will only get the "red background" shown in the image, but not the player interface, and playback does not work (note that the background color of MediaElement is set to red in the above XAML )
Basic Information
- Version with issue: 1.1.0
- Last known good version: 1.0.3
- IDE: Visual Studio Community 2019
- Platform Target Frameworks:
- UWP: 19041
Workaround
Downgrade to 1.0.3
Reproduction imagery

I've tried it with the sample app and that seems to work fine.
Could you maybe add a little reproduction project to show the issue? That would really help tracking this down. Thanks!
I've tried it with the sample app and that seems to work fine.
Could you maybe add a little reproduction project to show the issue? That would really help tracking this down. Thanks!
Thanks a lot for your help Versluis. After patient investigation, I think I found the origin of the problem. It does not seem to be directly related to the MediaElement
The problem seems to be in the combination of the Xamarin Community Toolkit version being used and the "Targeting Min Version" setting in the properties of the UWP project in the Xamarin Solution ' If I use Xamarin Community Toolkit 1.0.3 with "Min Targeting Version" setting on Windows 10 Version 1809 Build 17763 or above, the UWP project with the Xamarin Community Toolkit MediaElement renders correctly on screen
If I use Xamarin Community Toolkit 1.1.0 with "Min Targeting Version" setting on Windows 10 Version 2004 Build 19041, the UWP project with the Xamarin Community Toolkit MediaElement renders correctly on screen.
Any other combination fails as per the image previously enclosed in this thread.
(my Windows 10 operating system is currently Build 19041)
May I please ask if this is a bug or on the contrary it is expected behavior? I took the opportunity to read about "Targeting Versions" and it sounds that even if my "Min Target Version" was set to 17763 (I think), the problem should not have occurred with XCT 1.1.0.
Your insight, if possible for you, would be very highly appreciated. Thanks!
I can also replicate this issue with V1.1.0 of community toolkit.
Downgrading to V1.0.3 fixed the issue
In terms of my target version and min versions are as follows:
Target Version: Windows 10 Version 2004 (10.0 build 19041) Min Version: Windows 10 Version 1809 (10.0 build 17763)
@JKennedy24 just for science, could you upgrade your min. version to build 19041 and see if that works?
@JKennedy24 just for science, could you upgrade your min. version to build 19041 and see if that works?
@pictos: as per my original message, yes XCT 1.1.0 works OK if you set the min version to build 19041. In my tests, as per my original report:
"If I use Xamarin Community Toolkit 1.0.3 with "Min Targeting Version" setting on Windows 10 Version 1809 Build 17763 or above, the UWP project with the Xamarin Community Toolkit MediaElement renders correctly on screen If I use Xamarin Community Toolkit 1.1.0 with "Min Targeting Version" setting on Windows 10 Version 2004 Build 19041, the UWP project with the Xamarin Community Toolkit MediaElement renders correctly on screen. Any other combination fails as per the image previously enclosed in this thread."
Thanks!
@coquilanka thanks, didn't see all comments, sorry for that hehe
@coquilanka and all, would you be able to test this NuGet maybe: https://dev.azure.com/xamarin/public/_build/results?buildId=39270&view=artifacts&pathAsName=false&type=publishedArtifacts
If you don't know how to test one from an artifact, this should help: https://blog.verslu.is/xamarin/xamarin-forms-xamarin/test-xamarin-forms-bugfixes/
Wondering if that fixes it for all scenarios
@coquilanka and all, would you be able to test this NuGet maybe: https://dev.azure.com/xamarin/public/_build/results?buildId=39270&view=artifacts&pathAsName=false&type=publishedArtifacts
If you don't know how to test one from an artifact, this should help: https://blog.verslu.is/xamarin/xamarin-forms-xamarin/test-xamarin-forms-bugfixes/
Wondering if that fixes it for all scenarios
I just tested the nuget and the MediaElement is still not working in UWP. With the following configuration: Target version: 1903 Min version: 1809
I just created a test project where the problem can be reproduced: https://github.com/nacompllo/MediaElementIssue
I just created a test project where the problem can be reproduced: https://github.com/nacompllo/MediaElementIssue
Was going to try this but the shared project seems to be missing from this repo @nacompllo :)
I just created a test project where the problem can be reproduced: https://github.com/nacompllo/MediaElementIssue
Was going to try this but the shared project seems to be missing from this repo @nacompllo :)
I just cloned it and the shared project looks good. I understand why you say that you only see the specific projects of the platforms?
I just created a test project where the problem can be reproduced: https://github.com/nacompllo/MediaElementIssue
Was going to try this but the shared project seems to be missing from this repo @nacompllo :)
I just cloned it and the shared project looks good. I understand why you say that you only see the specific projects of the platforms?
Oh wow that's weird. I didn't check the repo, it is indeed there, my bad. Must've been something weird on my side. I will try again 😅
Same issue here. Any update on this?
Also seeing the same problem with our UWP project:
- Target Version:
Windows 10, version 2004 (10.0; Build 19041) - Min Version:
Windows 10, version 1809 (10.0; Build 17763) - Xamarin.Forms:
v5.0.0.2125 - Xamarin.CommunityToolkit:
v1.3.0
Using Xamarin.Forms 5.0.0.2337 Xamarin Community Toolkit 2.0.0
The Media player using a URL (did not test with files) only works with Windows min version = Window 10 1903