C
C#12mo 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
Cattywampus12mo 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
kevinOP12mo ago
Thanks!
Cattywampus
Cattywampus12mo ago
feel free to close this if it answered your question
Want results from more Discord servers?
Add your server