title: LibVLC Demux Cannot Peek
body: <p>I'm attempting to use LibVLC to eventually stream video in a larger application, but for now I'm working off of a <a href="https://wiki.videolan.org/LibVLC_Tutorial/" rel="nofollow noreferrer">tutorial</a>. Current goal is simply to stream a video saved on my computer</p>
  
  <p>When I walk through the program with the debugger, the error code </p>
  
  <blockquote>
    <p>[00000216266e7650] mjpeg demux error: cannot peek </p>
  </blockquote>
  
  <p>appears after line 56: </p>
  
  <blockquote>
    <p>libvlc_media_player_stop(mp);</p>
  </blockquote>
  
  <p>The video had to be placed in the same location as main.cpp (instead of wherever I wanted with an explicit file path). It's a .wmv file.</p>
  
  <p>I am using LibVLC 3.0.7.1, obtained as a NuGet package for Visual Studio. 
  I cannot build libVLC from the source because I a) struggle to use Linux and don't have easy access to it, b) cannot install all of the tools needed to crosscompile on a Windows machine, and c) because I am still very new to this</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;Windows.h&gt;
  
  //extern "C" {
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\vlc.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media_player.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_dialog.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_events.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media_discoverer.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media_library.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media_list.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_media_list_player.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_renderer_discoverer.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_version.h&gt;
  #include &lt;C:\GIT\PVI\packages\VideoLAN.LibVLC.Windows.3.0.7.1\build\x64\include\vlc\libvlc_vlm.h&gt;
  //}
  
  int main(int argc, char* argv[])
  {
      libvlc_instance_t * inst;
      libvlc_media_player_t *mp;
      libvlc_media_t *m;
  
      /* Load the VLC engine */
      inst = libvlc_new(0, NULL);
  
      /* Create a new item */
      m = libvlc_media_new_path(inst, "1_Holiday_Sale_v6.wmv");
      //m = libvlc_media_new_path (inst, "/path/to/test.mov");
  
      /* Create a media player playing environement */
      mp = libvlc_media_player_new_from_media(m);
  
      /* No need to keep the media now */
      libvlc_media_release(m);
  
  #if 0
      /* This is a non working code that show how to hooks into a window,
       * if we have a window around */
      libvlc_media_player_set_xwindow(mp, xid);
      /* or on windows */
      libvlc_media_player_set_hwnd(mp, hwnd);
      /* or on mac os */
      libvlc_media_player_set_nsobject(mp, view);
  #endif
  
      /* play the media_player */
      libvlc_media_player_play(mp);
  
      Sleep(10); /* Let it play a bit */
  
      /* Stop playing */
      libvlc_media_player_stop(mp);
  
      /* Free the media_player */
      libvlc_media_player_release(mp);
  
      libvlc_release(inst);
  
  
      return 0;
  }
  </code></pre>