My Code Example:
Code: Select all
public VlcControl control;
public void Player(string url,int volume){
this.control = new VlcControl();
var currentAssembly = Assembly.GetEntryAssembly();
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
var libDirectory = new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
control.BeginInit();
control.VlcLibDirectory = libDirectory;
control.Dock = DockStyle.Fill;
control.EndInit();
this.Controls.Add(control);
control.SetMedia(new Uri(@"" + url + ""));
control.Audio.Volume=volume;
control.Play();
}
Code: Select all
Player("C:\\test\video1.mp4",50);
Player("C:\\test\video2.mp4",75);
The first video opens and the volume becomes 50. Then when I open the second video, the volume of both videos is 75.
I use these packages,
- VideoLAN.LibVLC.Windows (Version 3.0.0) https://www.nuget.org/packages/VideoLAN.LibVLC.Windows
- Vlc.DotNet.Forms (Version 3.0.0) https://github.com/ZeBobo5