Here's the sample code:
Private inst As Pointer
Private mp As Pointer
Private m As Pointer Library "libvlc:5.6.0"
' enum libvlc_state_t
Private Enum libvlc_NothingSpecial = 0, libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused, libvlc_Stopped, libvlc_Ended, libvlc_Error
' enum libvlc_video_orient_t
Private Enum libvlc_video_orient_top_left = 0, libvlc_video_orient_top_right, libvlc_video_orient_bottom_left, libvlc_video_orient_bottom_right, libvlc_video_orient_left_top, libvlc_video_orient_left_bottom, libvlc_video_orient_right_top, libvlc_video_orient_right_bottom
' Create And initialize a libvlc instance.
Private Extern libvlc_new(argc As Integer, argv As String[]) As Pointer
' Create a media for a certain file path.
Private Extern libvlc_media_new_path(p_instance As Pointer, path As String) As Pointer
' Create a Media Player object from a Media.
Private Extern libvlc_media_player_new_from_media(p_md As Pointer) As Pointer
' Set an X Window System drawable where the media player should render its video output.
Private Extern libvlc_media_player_set_xwindow(p_mi As Pointer, drawable As Integer)
' Play the video file.
Private Extern libvlc_media_player_play(p_mi As Pointer) As Integer
' Stop the video file
Private Extern libvlc_media_player_stop(p_mi As Pointer)
' Get the current movie length (in ms).
Private Extern libvlc_media_player_get_length(p_mi As Pointer, l_ex As Pointer) As Integer
' Get the current movie time (in ms).
Private Extern libvlc_media_player_get_time(p_mi As Pointer) As Integer
' Get current movie state.
Private Extern libvlc_media_player_get_state(p_mi As Pointer) As Integer
' Toggle breaks.
Private Extern libvlc_media_player_pause(p_mi As Pointer)
' Release a media_player after use Decrement the reference count of a media player object.
Private Extern libvlc_media_player_release(p_mi As Pointer)
' Decrement the reference count of a media descriptor object.
Private Extern libvlc_media_release(p_md As Pointer)
' Decrement the reference count of a libvlc instance, and destroy it if it reaches zero.
Private Extern libvlc_release(p_instance As Pointer)
'Set the movie time (in ms)
Private Extern libvlc_media_player_set_time(p_mi As Pointer, i_time As Long, b_fast As Boolean) As Integer
Public Sub ButtonPlay_Click()
' Initialize the VLC library
inst = libvlc_new(0, Null)
' Create a new multimedia object.
m = libvlc_media_new_path(inst, "/home/user/Videos/first_vid.mp4")
' Create a media player
mp = libvlc_media_player_new_from_media(m)
' To show the video in the "DrawingArea", we get his identifier
Dim id As Integer = DrawingArea1.Id
' We pass the identifier of the window, in which the video must be shown
libvlc_media_player_set_xwindow(mp, id)
' Starts the execution of the video file by the media player :
libvlc_media_player_play(mp)
' Repeat
' TextLabel1.Text = "Durata: " & Str(Time(0, 0, 0, libvlc_media_player_get_length(mp, 0)))
' TextLabel2.Text = "<font color=red>" & Str(Time(0, 0, 0, libvlc_media_player_get_time(mp))) & "</font>"
' Wait 0.01
' Until libvlc_media_player_get_state(mp) > libvlc_Paused
'
' Chiude()
End
Public Sub ButtonSeek_Click()
libvlc_media_player_set_time(mp, 2000, False)
End
Public Sub ToggleButtonPause_Click()
libvlc_media_player_pause(mp)
End
Public Sub ButtonStop_Click()
libvlc_media_player_stop(mp)
End
Private Procedure Chiude()
'Closes the VLC library
libvlc_media_player_release(mp)
libvlc_media_release(m)
libvlc_release(inst)
End