简体   繁体   中英

Xamarin Android-Video player Black screen

I'm using the Xamarin Android Player emulator to test the app I'm developing. The emulator doesn't play video at all. There's a black screen in place of the videoview.

I've written very simple code just to test the video playback. The code is below:

namespace Training
{
    [Activity(Label = "", Icon = "@drawable/icon", Theme = "@style/MyTheme")]
    class videotest : ActionBarActivity
    {
        private Android.Support.V7.Widget.Toolbar mToolbar;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            SetContentView(Resource.Layout.videotest);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "";


            var videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
            var uri = Android.Net.Uri.Parse("http://www.printopack.somee.com/Uploaded/Grad2.mp4");
            videoView.SetVideoURI(uri);
            videoView.Start();




        }



    }
}

Try testing it on a real device. When I was working with video views in Xamarin.Android the same thing happened to me on the emulator but on a real device it worked just fine.

its a lie i test on emulator and in phone and all black screen dont lose you time this api dont work...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM