Hello dear devs.
I am trying to implement VLC in my WPF application.
I've installed the follow nugets :
LibVLCSharp
LibVLCSharp.WPF
VideoLAN.LibVLC.Windows
..
in the XAML:
<uc:VideoView Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="2" x:Name="VideoView" />
....
in App.xaml.cs:
in App constructor:
Core.Initialize( "C:\\Program Files\\VideoLAN\\VLC" );
...
LibVLC _libVLC;
MediaPlayer _mediaPlayer;
in the Window.xaml.cs:
private void Window_Loaded( object sender, RoutedEventArgs e )
{
VideoView.Loaded += VideoView_Loaded;
}
private void VideoView_Loaded(object sender, RoutedEventArgs e)
{
_libVLC = new LibVLC(enableDebugLogs: true);
_mediaPlayer = new MediaPlayer(_libVLC);
VideoView.MediaPlayer = _mediaPlayer;
}
and in some button click :
if (!VideoView.MediaPlayer.IsPlaying)
{
using (var media = new Media(_libVLC, new Uri("rtsp://192.168.0.21:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif&user=admin&password=")))
VideoView.MediaPlayer.Play(media);
}
..
yet.. nothing happens, but I am receiving : "No MediaPlayer is set, aborting..."
What this means and how to fix it in order to run a stream from my IP camera ?