No MediaPlayer is set, aborting...

This forum is about all development around libVLC.
Yordan1
New Cone
New Cone
Posts: 4
Joined: 25 May 2023 00:35

No MediaPlayer is set, aborting...

Postby Yordan1 » 25 May 2023 00:46

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 ?

mfkl
Developer
Developer
Posts: 746
Joined: 13 Jun 2017 10:41

Re: No MediaPlayer is set, aborting...

Postby mfkl » 26 May 2023 07:58

Post a full yet minimal sample on github so we can try locally. Thanks.
https://mfkl.github.io

Yordan1
New Cone
New Cone
Posts: 4
Joined: 25 May 2023 00:35

Re: No MediaPlayer is set, aborting...

Postby Yordan1 » 26 May 2023 09:22

Post a full yet minimal sample on github so we can try locally. Thanks.
Hello.
Here : https://github.com/YordanYanakiev/VLCTest

mfkl
Developer
Developer
Posts: 746
Joined: 13 Jun 2017 10:41

Re: No MediaPlayer is set, aborting...

Postby mfkl » 30 May 2023 06:22

_mediaPlayer is null when you set it to the view. Please check the official WPF sample in the libvlcsharp repository, which works fine.
https://mfkl.github.io

Yordan1
New Cone
New Cone
Posts: 4
Joined: 25 May 2023 00:35

Re: No MediaPlayer is set, aborting...

Postby Yordan1 » 31 May 2023 11:51

Thank You !


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 4 guests