Code: Select all
/* Not working */
Declarations.IMediaPlayerFactory factory = new Implementation.MediaPlayerFactory();
//m_hMediaLib = LibVlcMethods.libvlc_new(args.Length, args); {"-I", "dumy", "--ignore-config", "--no-osd", "--disable-screensaver", "--plugin-path=./plugins"}
//LibVlcMethods.libvlc_log_set(m_instance, hCallback, IntPtr.Zero);
string sout = ":sout=#rtp{dst=127.0.0.1,port=5004,ttl=40,mux=ts}";
media = factory.CreateMedia(@"dshow://", WebCams[InputDeviceSelection.SelectedIndex].ToString(), sout);
//m_hMedia = LibVlcMethods.libvlc_media_new_location(m_hMediaLib, m_path.ToUtf8()); "dshow://"
//LibVlcMethods.libvlc_media_add_option(m_hMedia, item.ToUtf8()); "[0] Sony Visual Communication Camera: SOME_GUID"
//LibVlcMethods.libvlc_media_add_option(m_hMedia, item.ToUtf8()); ":sout=#rtp{dst=127.0.0.1,port=5004,ttl=40,mux=ts}"
renderPlayer = factory.CreatePlayer();
//LibVlcMethods.libvlc_media_player_new(m_hMediaLib);
//LibVlcMethods.libvlc_media_player_retain(m_hMediaPlayer);
renderPlayer.Open(media);
//LibVlcMethods.libvlc_media_player_set_media(m_hMediaPlayer, ((INativePointer)media).Pointer);
renderPlayer.Play();
//LibVlcMethods.libvlc_media_player_play(m_hMediaPlayer);
Code: Select all
/* Working streaming file */
var input = @"C:\Users\buloheart\Downloads\SomeVideo.mkv";
Declarations.IMediaPlayerFactory factory = new Implementation.MediaPlayerFactory();
//m_hMediaLib = LibVlcMethods.libvlc_new(args.Length, args); {"-I", "dumy", "--ignore-config", "--no-osd", "--disable-screensaver", "--plugin-path=./plugins"}
//LibVlcMethods.libvlc_log_set(m_instance, hCallback, IntPtr.Zero);
string sout = ":sout=#rtp{dst=127.0.0.1,port=5004,ttl=40,mux=ts}";
media = factory.CreateMedia(input, sout);
//m_hMedia = LibVlcMethods.libvlc_media_new_path(m_hMediaLib, m_path.ToUtf8());
//LibVlcMethods.libvlc_media_add_option(m_hMedia, item.ToUtf8()); ":sout=#rtp{dst=127.0.0.1,port=5004,ttl=40,mux=ts}"
renderPlayer = factory.CreatePlayer();
//LibVlcMethods.libvlc_media_player_new(m_hMediaLib);
//LibVlcMethods.libvlc_media_player_retain(m_hMediaPlayer);
renderPlayer.Open(media);
//LibVlcMethods.libvlc_media_player_set_media(m_hMediaPlayer, ((INativePointer)media).Pointer);
renderPlayer.Play();
//LibVlcMethods.libvlc_media_player_play(m_hMediaPlayer);
/**/
Code: Select all
/* Working displaying from camera */
Declarations.IMediaPlayerFactory factory = new Implementation.MediaPlayerFactory();
//m_hMediaLib = LibVlcMethods.libvlc_new(args.Length, args); {"-I", "dumy", "--ignore-config", "--no-osd", "--disable-screensaver", "--plugin-path=./plugins"}
//LibVlcMethods.libvlc_log_set(m_instance, hCallback, IntPtr.Zero);
media = factory.CreateMedia(@"dshow://", WebCams[InputDeviceSelection.SelectedIndex].ToString());
//m_hMedia = LibVlcMethods.libvlc_media_new_location(m_hMediaLib, m_path.ToUtf8()); "dshow://"
//LibVlcMethods.libvlc_media_add_option(m_hMedia, item.ToUtf8()); "[0] Sony Visual Communication Camera: SOME_GUID"
renderPlayer = factory.CreatePlayer();
//LibVlcMethods.libvlc_media_player_new(m_hMediaLib);
//LibVlcMethods.libvlc_media_player_retain(m_hMediaPlayer);
renderPlayer.WindowHandle = PreviewPictureBox.Handle;
//LibVlcMethods.libvlc_media_player_set_hwnd(m_hMediaPlayer, value);
renderPlayer.Open(media);
//LibVlcMethods.libvlc_media_player_set_media(m_hMediaPlayer, ((INativePointer)media).Pointer);
renderPlayer.Play();
//LibVlcMethods.libvlc_media_player_play(m_hMediaPlayer);
/**/
Thanks...