locked
Exception when trying to run SetOn implements from the MediaPlayer Xamarin API RRS feed

  • Question

  • 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;
                }
            }
    
        }

    Wednesday, January 24, 2018 11:10 PM

Answers

  • I'd ask for help over here in xamarin forums.

    https://forums.xamarin.com/

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Wednesday, January 24, 2018 11:20 PM