casillas
casillas

Reputation: 16793

Video is running but shows only black screen in Xamarin

I have created a folder called raw and added tutorial.mp4 and trying to run it on the VideoView.

I could able to see the duration of the video but video is all black, it does not show the actual video .

I am running on Xamarin Android Player emulator. I wonder I am missing?

using Uri = Android.Net.Uri;


var videoView = view.FindViewById<VideoView>(Resource.Id.myVideo);
var uri = Uri.Parse("android.resource://" + this.Activity.BaseContext.PackageName  + "/raw/tutorial");
videoView.SetVideoURI(uri);
videoView.Start();

Upvotes: 0

Views: 514

Answers (1)

SushiHangover
SushiHangover

Reputation: 74094

If the video is black (but you might actual hear the audio), then the emulator does not support the codec your video are using.

Use a real device or use a different emulator (Google's AVD w/ Intel Haxm, Visual Studio's Android Player, Genymotion).

FYI: Xamarin Android Player (XAP) has been deprecated for some time now...

VideoView from a raw Resource:

var uri = Uri.Parse("android.resource://" + PackageName + "/" + Resource.Raw.B);
videoView.SetVideoURI(uri);

Upvotes: 1

Related Questions