Question I can't control the video with the TrackBar1 scroller with Axvlc plugin c#

omar7625

Member
Joined
Feb 22, 2024
Messages
10
Programming Experience
1-3
I have tried axVLCPlugin21.input.time = trackBar1.Value; but to no avail

code.....

C#:
private void trackBar1_Scroll(object sender, EventArgs e)
{
    axVLCPlugin21.input.time = trackBar1.Value;
}

private void axVLCPlugin21_MediaPlayerTimeChanged(object sender, AxAXVLC.DVLCEvents_MediaPlayerTimeChangedEvent e)
{
    lb_START.Text = TimeFormat(e.time);
    trackBar1.Value = e.time;
}

private void axVLCPlugin21_MediaPlayerPlaying(object sender, EventArgs e)
{
    lb_END.Text = TimeFormat((int)axVLCPlugin21.input.length);
    trackBar1.Maximum = (int)axVLCPlugin21.input.length;
}
 
Last edited by a moderator:
At a breakpoint on your Scroll or ValueChanged event. What value is being passed in?
 
Why are you passing in e.Time? I would have have expected you to be passing in trackBar1.Value.

What exactly is the value of that trackBar1.Value when you inspect the value in the debugger when the breakpoint is hit?

Basically we are trying to figure out why it works to do this:
C#:
axVLCPlugin21.input.time = 90000;
but somehow you are saying this doesn't work:
C#:
// assuming that trackBar1.Value is some value like 90000 according to the debugger
axVLCPlugin21.input.time = trackBar1.Value;
 
Why are you passing in e.Time? I would have have expected you to be passing in trackBar1.Value.

What exactly is the value of that trackBar1.Value when you inspect the value in the debugger when the breakpoint is hit?

Basically we are trying to figure out why it works to do this:
C#:
axVLCPlugin21.input.time = 90000;
but somehow you are saying this doesn't work:
C#:
// assuming that trackBar1.Value is some value like 90000 according to the debugger
axVLCPlugin21.input.time = trackBar1.Value;

The value of TrackBar1 is the time from the beginning to the end of the video and is determined by the e.Time variable programmed by AxAXVLC.

C#:
namespace AxAXVLC
{
    public class DVLCEvents_MediaPlayerTimeChangedEvent
    {
        public int time;

        public DVLCEvents_MediaPlayerTimeChangedEvent(int time)
        {
            this.time = time;
        }
    }
}

But the value of trackBar1.Maximum is given by axVLCPlugin21.input.length

I will upload pictures of the debugger. I hope they help. I am sorry if my answers to the questions were inaccurate. I am a beginner in the C# language.
Screenshot 2024-02-24 144935.png
Screenshot 2024-02-24 145109.png
 
So, you're saying that if you use a literal value of 90000 it works - some of the time, at least - but if you use trackBar1.Value and it's equal to 90000 then it never works? I don't see how that's possible. There must be something else different.
New update when I use Thread.Sleep(3000); after axVLCPlugin21.input.time = TrackBar1.Value; It works, but it's not an amazing success. I wait three seconds every time
 
It's still not clear why that would happen when you do not need the Sleepwhen using a literal value.
 
Back
Top Bottom