CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier

Home Page:https://learn.microsoft.com/dotnet/communitytoolkit/maui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] MediaElement can't play video

maslewandowski opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

I have bound the source property of the media element:

XAML:
<toolkit:MediaElement ShouldShowPlaybackControls="True" Grid.Row="2" Source="{Binding SelectedMediaFile, Mode=TwoWay}"/>

Viewmodel C#:
SelectedMediaFile = MediaSource.FromFile(media.LocalPath);

The local path is build up dynamically using the correct approach:
/Users/myname/Library/Developer/CoreSimulator/Devices/9C591F9C-B484-467C-8B51-91E569E65FB6/data/Containers/Data/Application/4DE1E875-E37A-42ED-AE0F-B4D2A1C6010D/Library/media/filename.mp4

After i have set the file to be the source, the player shows this icon:
Bildschirmfoto 2024-06-24 um 15 28 02

Also the debug output says this:
[0:] MediaManager: Error: Cannot Open - This media may be damaged.

I have saved the same filestream with the FileSaver class to see, if the video is playable by the ios simulator.
The video can be played without any problems.

Am i missing something?

Expected Behavior

The file should be playable in the MediaElement player.

file: click

Steps To Reproduce

bind a mediasource property in vm and try to play the video

Link to public reproduction project repository

Environment

- .NET MAUI CommunityToolkit:9.0.1
- .NET MAUI MediaElement 4.0.0
- OS: IOS 17.2
- .NET MAUI: 8.0.40

Anything else?

No response

Hi @maslewandowski. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.