pauldotknopf / nVLC

VLC wrappers for .NET (WPF/WindowsForms/etc), based on http://www.codeproject.com/Articles/109639/nVLC
GNU General Public License v3.0
10 stars 7 forks source link

build nvlc for x64 platform #1

Open ahmadi219 opened 7 years ago

ahmadi219 commented 7 years ago

Hi I want to use nvlc wrapper in a x64 platform (wpf prgramming). I built nvlc code for x64 platform but when I use it in my application, it suddenly closes. Some times it show in output window that it can not connect to my rtsp address, some times it can not play webcam. it shows access violation and ... I searched in code project nvlc article . Some one wrote to change Utile Class in nvlc.Implementation . Is it a correct solution ? Could you send me a stable code for x64 platform . Please upload in github,

fahminlb33 commented 6 years ago

I'm just tested this library with VLC 2.2.6 Umbrella (x64) and I could stream from RTST and M3U8. It both working on WinForms and WPF after a bit of changes in the code. I suggest you to read the article on CodeProject to solve most of the problem with this library.

Here are my changes:

Change IMediaFromFile to IMedia. This will inform VLC to use URI instead of file path. https://github.com/pauldotknopf/nVLC/blob/21ce49399a67c98fc5ceeb658eddd7280751555b/src/nVLC_Demo_WPF/Window1.xaml.cs#L37

https://github.com/pauldotknopf/nVLC/blob/21ce49399a67c98fc5ceeb658eddd7280751555b/src/nVLC_Demo_WPF/Window1.xaml.cs#L110

Also remove OpenFileDialog, since we're using URI https://github.com/pauldotknopf/nVLC/blob/21ce49399a67c98fc5ceeb658eddd7280751555b/src/nVLC_Demo_WPF/Window1.xaml.cs#L104-L117

Here's my code:

    private void button1_Click(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog ofd = new OpenFileDialog();
            //if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
            //textBlock1.Text = ofd.FileName;
            m_media = m_factory.CreateMedia<IMedia>("https://cdn-livetv1.metube.id/hls/rcti.m3u8");
            m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged);
            m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged);

            m_player.Open(m_media);
            m_media.Parse(true);
        }