When I run my Xamarin Forms application with the MediaPlayer API of the error and the program stops running from these lines below;
video.SetOnPreparedListener(new videoLooping());
[Activity(Label = "AppExibeVideo", MainLauncher = true)]
public class MainActivity : Activity
{
VideoView video = null;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
video = FindViewById<VideoView>(Resource.Id.videoView);
string path = "android.resource://" + PackageName + "/" + Resource.Drawable.a;
video.SetVideoPath(path);
video.SetOnPreparedListener(new videoLooping());
video.RequestFocus();
video.Start();
}
public class videoLooping : Java.Lang.Object, IOnPreparedListener
{
public void OnPrepared(MediaPlayer mp)
{
mp.Looping = true;
}
}
}