I am currently migrating my Xamarin Forms app to MAUI. On the introPage we are playing a video as background. On iOS we call the video just like this
<grial:VideoPlayer x:Name="videoPlayer"
IsMuted="True"
Style="{ StaticResource BackgroundVideoPlayerStyle }"
Source="introvideo.mp4" />
(We use grial as frontend framework and there for their videoPlayer)
The problem occurs when trying to build my app for an Android-Device (Simulator and real phone have the same behaviour). There it is just black with an error message, that the video could not be found.
Location of the video is “Resource/Raw/introvideo.mp4”.
I also tried to call add the source via the code behind like this
public string VideoSource {
get {
string filePath = "";
if (DeviceInfo.Platform == DevicePlatform.Android)
filePath = Path.Combine(FileSystem.AppDataDirectory, "Resources/Raw", "introvideo.mp4");
else if (DeviceInfo.Platform == DevicePlatform.iOS)
filePath = "introvideo.mp4";
return filePath;
}
}
(Yeah, I binded the videoSource to the grialPlayer)
Maybe some of you have some experience with this and could help me.
Thanks