Click here to Skip to main content
11,798,866 members (69,960 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET media player , +
Is there any method of showing what percentage of a VLC player clip in VB.NET has buffered in a label?

For further clarification:
What I'm wanting, is to show what percentage of a clip has been buffered into a label. I am viewing this clip in VLC within VB.NET

Code so far below:

Imports System.Text.RegularExpressions
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
        Started = True
    End Sub
    Sub playsecond()
        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
            Started = True
        End If
    End Sub
    Private Sub AxVLCPlugin21_play(sender As Object, e As EventArgs) Handles
        Paused = False
    End Sub
    Private Enum InputState
        IDLE = 0
        OPENING = 1
        BUFFERING = 2
        PLAYING = 3
        PAUSED = 4
        STOPPING = 5
        ENDED = 6
        ERRORSTATE = 7
    End Enum

    Private Sub InfoTimer_Tick(sender As Object, e As EventArgs) Handles InfoTimer.Tick
        Dim state As InputState = DirectCast(AxVLCPlugin21.input.state, InputState)
        Select Case state
            Case InputState.IDLE, InputState.OPENING, InputState.BUFFERING
                Status.Text = state.ToString()
                Exit Select
            Case InputState.PLAYING
                Dim title As String = System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title)
                Dim current As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Time)
                Dim total As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Length)
                Dim pos As Double = AxVLCPlugin21.input.Position
                Status.Text = String.Format("{0} {1} {2}:{3:D2}/{4}:{5:D2} {6:P}", state, title, current.Minutes, current.Seconds, total.Minutes, total.Seconds, pos)
                Exit Select
            Case InputState.PAUSED
                Status.Text = String.Format("{0} {1}", state, System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title))
                Exit Select
            Case InputState.STOPPING, InputState.ENDED
                Exit Select
            Case InputState.ERRORSTATE
                Status.Text = String.Format("{0} {1}", state, AxVLCPlugin21.mediaDescription.title)
                Exit Select
            Case Else
                Status.Text = state.ToString()
                Exit Select
        End Select
    End Sub
End Class
Posted 28-Jan-13 6:08am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Does not work. Won't show buffered so far In label at all
Andrew Smith at 29-Jan-13 11:10am
I'm looking for someone to show me how to do it. The code above doesn't do that, that's why I've came here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 505
1 OriginalGriff 348
2 Richard MacCutchan 321
3 Maciej Los 255
4 phil.o 244
0 OriginalGriff 2,270
1 Maciej Los 1,810
2 KrunalRohit 1,496
3 CPallini 1,425
4 Richard MacCutchan 1,109

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100