title: Xamarin Android Player - Can't play this video
body: <p>I'm using Android's VideoView to play an embedded video in my app. It works fine on my device but I keep getting a "Can't play this video" message and a black screen in the Xamarin Android Player.</p>
  
  <p><img src="https://i.stack.imgur.com/Qqwaq.png" alt="error message"></p>
  
  <p>The corresponding error log looks like this:</p>
  
  <pre><code>Unable to play video
  [MediaPlayer] Error (1,-38)
  [VideoView] Error: 1,-38
  </code></pre>
  
  <p>I found a few posts regarding this error but none of them helped me solving this issue and I'm not able to find a proper description for this status code.</p>
  
  <p>My C# code looks like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>videoView = new VideoView (Context);
  base.SetNativeControl (videoView);
  videoView.SetOnErrorListener (new ErrorListener ());
  
  string fileName = e.NewElement.FileSource;
  fileName = fileName.ToLower ().Substring (0, fileName.LastIndexOf ("."));
  int resourceID = Context.Resources.GetIdentifier (fileName, "raw", Context.PackageName);
  var fullPath = String.Format ("android.resource://{0}/{1}", Context.PackageName, resourceID);
  
  videoView.SetVideoPath (fullPath);
  videoView.RequestFocus ();
  videoView.Start ();
  </code></pre>