如何在vb.net中检测vlc视频播放中的当前位置?
基本上,当剪辑正在播放时,我想在标签中说出与正在播放的当前剪辑有关的“02:58/21:35”。
所以我需要以某种方式弄清楚如何检测当前位置和结束位置。有谁知道怎么做?
到目前为止代码:
Public Class Form1
Dim Paused As Boolean = False
Dim Started As Boolean = False
Dim PlayedSecond As Boolean = True
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PlayedSecond = False
AxVLCPlugin21.playlist.items.clear()
AxVLCPlugin21.playlist.add("https://vula.uct.ac.za/access/content/group/fe879ca4-927a-4fca-9cc9-33b12c348b37/vids/Lessig-ItIsAboutTimeGettingOurValuesAroundCopyright522.flv")
AxVLCPlugin21.playlist.play()
Started = True
End Sub
Sub playsecond()
AxVLCPlugin21.playlist.items.clear()
AxVLCPlugin21.playlist.add("http://lsta2011.wikispaces.com/file/view/Rogue%20Waves.mp4")
AxVLCPlugin21.playlist.play()
PlayedSecond = True
Started = False
End Sub
Private Sub AxVLCPlugin21_pause(sender As Object, e As EventArgs) Handles AxVLCPlugin21.pause
Paused = True
End Sub
Private Sub IsFinished_Tick(sender As Object, e As EventArgs) Handles IsFinished.Tick
If Not AxVLCPlugin21.playlist.isPlaying And Paused = False And Started = True And PlayedSecond = False Then
playsecond()
Started = True
End If
End Sub
Private Sub AxVLCPlugin21_play(sender As Object, e As EventArgs) Handles AxVLCPlugin21.play
Paused = False
End Sub
End Class
答案 0 :(得分:2)
根据the documentation,您可以通过阅读以下属性来获取当前位置和视频长度:
AxVLCPlugin21.input.time
获取当前位置。AxVLCPlugin21.input.length
,其中包含视频的长度。这两个属性都是以毫秒为单位;你必须在几小时,几分钟和几秒钟内自己转换它们。