title: libvlc check if media location is valid
body: <p>I'm using libvlc and I want to check if a media location/path is valid or not:</p>
  
  <pre><code>libvlc_instance_t* inst = libvlc_new(0, NULL);
  
  libvlc_media_t* m = libvlc_media_new_path(inst, "/path/to/nothing");
  
  if (m == NULL)      // Not working
      printf("Err\n");
  
  libvlc_media_player_t* mp = libvlc_media_player_new_from_media(m);
  
  libvlc_media_player_play(mp);
  
  printf("Error: %s\n", libvlc_errmsg()); // (null)
  
  libvlc_media_release(m);
  libvlc_media_player_release(mp);
  libvlc_release(inst);
  
  
  return 0;
  </code></pre>
  
  <p>Libvlc prints some error messages, but I was not able to catch any error in my own code:</p>
  
  <pre><code>Error: (null)
  [0x7f8cc0004a58] filesystem access error: cannot open file /path/to/nothing (No such file or directory)
  [0x7f8cc0004a58] main access error: File reading failed
  [0x7f8cc0004a58] main access error: VLC could not open the file "/path/to/nothing" (No such file or directory).
  </code></pre>