0

如何在 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
4

1 回答 1

2

根据文档,您可以通过读取以下属性来获取视频的当前位置和长度:

  • AxVLCPlugin21.input.time获取当前位置。
  • AxVLCPlugin21.input.length其中包含视频的长度。

这两个属性都以毫秒为单位;您必须自己在小时、分钟和秒内转换它们。

于 2013-04-23T08:47:54.947 回答