C
C#13mo ago
kevin

Cant play video in MAUI

Hey I'm trying to play a background video in MAUI, my underlying code is:
<toolkit:MediaElement x:Name="BgVideo" Source="Resources/Raw/video.mp4" ShouldShowPlaybackControls="False"
ShouldLoopPlayback="True" Aspect="AspectFill" ShouldAutoPlay="True"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
<toolkit:MediaElement x:Name="BgVideo" Source="Resources/Raw/video.mp4" ShouldShowPlaybackControls="False"
ShouldLoopPlayback="True" Aspect="AspectFill" ShouldAutoPlay="True"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
however it doesn't play the video if i change the path to a URL it works fine, is my path wrong ?
3 Replies
Cattywampus
Cattywampus13mo ago
if it's MauiAssets (anything in your Raw folder) you'd do it like this Source="embed://MyFile.mp4" https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/mediaelement see the example there
kevin
kevinOP13mo ago
Thanks!
Cattywampus
Cattywampus13mo ago
feel free to close this if it answered your question

Did you find this page helpful?