I want to substitute XCT:MediaElement
with Plugin.MediaManger & Plugin.MediaManager.Forms
for my videos to play cross-platform. Documentation I've read this like 5 times and it still doesn't make any sense. I'm putting my video into Assets
in Android
and using XAML
code below. The picture is the output I get on the screen, it's just a black background which I can change to any color...
I've added the Init()
to the MainActivity
and also to the AppDelegate
. Followed everything step by step.
What really doesn't make any sense from the documentation is (Examples). CrossMediaManager
is a static class. I cannot create a new instance of static classes so I cannot actually assign anything to the layout
. How does it suppose to play anything on the screen if there is nothing that can actually consume this?
await CrossMediaManager.Current.PlayFromAssembly("somefile.mp3", typeof(BaseViewModel).Assembly);
await CrossMediaManager.Current.PlayFromResource("assets:///somefile.mp3");
await CrossMediaManager.Android.PlayFromResource(Resource.Raw.somefile.ToString());
Further, on the documentation you come across the Xamarin.Forms part where it shows how to do this is XAML
with mm:ViewView
now this makes more sense and I can also assign an x:Name
to it and pass through MVVM
pattern through the Behind Code
to the ViewModel
and so on, but this would be cool if the video played in the first place...
Any idea why this is happening?
Many Thanks in Advance.
Nuget Packges I've added: Plugin.MediaManager
& Plugin.MediaManager.Forms
<StackLayout BackgroundColor="Red"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
WidthRequest="400"
HeightRequest="600"
Margin="10"
Padding="20">
<mm:VideoView VerticalOptions="FillAndExpand"
Source="assets:///pea2.mp4"
AutoPlay="True"
ShowControls="True" />
</StackLayout>