mercredi 24 décembre 2014

VLC Player plugin for C# cannot set volume for the first video

I try to play video with vlc plugin in C# like this tutorial http://ift.tt/1CJQvXQ . I want to reduce audio volume. I set volume in vlc Properties to 0 and paste axVLCPlugin21.audio.Volume = 10; to every where in code. The first play of video not reduce volume . It's 100% volume . My code can reduce when I click change to secound video only.


How to set reduce volume for the first play video in vlc plugin with C# ?



public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
axVLCPlugin21.audio.Volume = 10;
}

private void Form1_Load(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo("H:/Movie");
FileInfo[] fi = di.GetFiles("*.mp4");

foreach(FileInfo curFile in fi)
{
listBox1.Items.Add(curFile.Name);
axVLCPlugin21.playlist.add("file:///"+ curFile.FullName);

}
axVLCPlugin21.audio.Volume = 10;

}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int selIndex = listBox1.SelectedIndex;
axVLCPlugin21.playlist.playItem(selIndex);
axVLCPlugin21.audio.Volume = 10;
}

private void axVLCPlugin21_MediaPlayerEndReached(object sender, EventArgs e)
{

if (listBox1.SelectedIndex < (listBox1.Items.Count - 1))
{

axVLCPlugin21.playlist.next();
listBox1.SelectedIndex += 1;
listBox1.Update();
axVLCPlugin21.audio.Volume = 10;
}
else
{

axVLCPlugin21.playlist.playItem(0);
listBox1.SelectedIndex = 0;
listBox1.Update();
axVLCPlugin21.audio.Volume = 10;
}
}

}

Aucun commentaire:

Enregistrer un commentaire