Question Need to use TrackBar Control along with VLC player

nsabarisri

New member
Joined
Jun 28, 2014
Messages
1
Programming Experience
3-5
Hi,

I want to use Tracker control to control the playing of video in VLC player embedded in my VB.NET form.

My code is as below.

Public Class Form1
Private Sub BrowseBut_Click(sender As Object, e As EventArgs) Handles BrowseBut.Click
Dim fd As OpenFileDialog = New OpenFileDialog()
Dim strFileName As String


fd.Title = "Select the video"
fd.InitialDirectory = "D:\"
' fd.Filter = "(*.mp4) |*.mp4"
fd.FilterIndex = 2
fd.RestoreDirectory = True


If fd.ShowDialog() = DialogResult.OK Then
strFileName = fd.FileName
End If
AxVLCPlugin21.playlist.add(strFileName)

End Sub


Private Sub playPauseBut_Click(sender As Object, e As EventArgs) Handles pauseBut.Click
AxVLCPlugin21.playlist.togglePause()
End Sub


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
AxVLCPlugin21.playlist.stop()
End Sub


Private Sub playBut_Click(sender As Object, e As EventArgs) Handles playBut.Click
AxVLCPlugin21.playlist.play()
Timer1.Start()
End Sub


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load



End Sub
Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
AxVLCPlugin21.input.Time = TrackBar1.Value
AxVLCPlugin21.playlist.play()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
With TrackBar1
.Minimum = .Minimum
.Maximum = AxVLCPlugin21.input.Length
.Value = .Value + 1
End With
End Sub
End Class

This way, if I move the tracker control to some new position, it is starting the play from beginning again. The vlc player is not taking the value of the tracker control to play the movie from the new position.
 
Back
Top