Problem with Vlc.DotNet in wpf/C#
Posted: 11 Aug 2015 13:49
We use the vlc player to show the stream von a asis camera over rtsp. Normaly it works very fine. But if the camera a disconectet for longer the 6 seconds, a withe screen will pop in the front of the application. We have checked all events, but we could not find the problem.
The Application is programmed in wpf/C#. The VLC player ist added on a user control. We used this libs.
using Vlc.DotNet.Core;
using Vlc.DotNet.Wpf;
using Vlc.DotNet.Core.Interops;
source code user-control:
public RtspCamUserControl()
{
InitializeComponent();
myControl.MediaPlayer.VlcLibDirectoryNeeded += MediaPlayer_VlcLibDirectoryNeeded;
}
void MediaPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
{
var currentAssembly = Assembly.GetEntryAssembly();
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
if (currentDirectory == null)
return;
if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
//e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x86\"));
e.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
else
//e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x64\"));
e.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
}
public void Play()
{
if (_url != null)
{
_is_playing = true;
try
{
myControl.MediaPlayer.Play(new Uri((_url)));
}
catch (Exception ex)
{
return;
}
}
return;
}
Thanks for your ansers in advance!!!!!
The Application is programmed in wpf/C#. The VLC player ist added on a user control. We used this libs.
using Vlc.DotNet.Core;
using Vlc.DotNet.Wpf;
using Vlc.DotNet.Core.Interops;
source code user-control:
public RtspCamUserControl()
{
InitializeComponent();
myControl.MediaPlayer.VlcLibDirectoryNeeded += MediaPlayer_VlcLibDirectoryNeeded;
}
void MediaPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
{
var currentAssembly = Assembly.GetEntryAssembly();
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
if (currentDirectory == null)
return;
if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
//e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x86\"));
e.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
else
//e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x64\"));
e.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
}
public void Play()
{
if (_url != null)
{
_is_playing = true;
try
{
myControl.MediaPlayer.Play(new Uri((_url)));
}
catch (Exception ex)
{
return;
}
}
return;
}
Thanks for your ansers in advance!!!!!