Page 1 of 1

Bug, the property Playing returns incorrect value

Posted: 22 Feb 2009 14:14
by Monty Mole
It seems to me that the property Playing returns an incorrect value. This concerns version 0.9.8.1 of plugin V1, I'm sure this has been working in earlier version.

I am using VB.net 2008, Windows Vista SP1.

This is how I done the test:

-VB.net 2008, create new Windows Forms Application project.
-To Form1, add 1 VideoLAN VLC ActiveC Plugin v1, 1 textbox, 5 buttons.
-Add the code below.
-Start the application
-Enter a path/name of a movie file in the text box
-Click Load
-Click Play
-Click "Check if playing", working correct.
-Click Pause
-Click "Check if playing", working correct.
-Click Play
-Click "Check if playing", NOT working correct.
-NOTE CLICK STOP BEFORE CLOSING THE APPLICATION, WINDOWS MIGHT CRASH OTHERWISE.

----------------

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxVLCPlugin1.playlistClear()
AxVLCPlugin1.addTarget(TextBox1.Text, Nothing, AXVLC.VLCPlaylistMode.VLCPlayListReplace, 0)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxVLCPlugin1.play()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AxVLCPlugin1.pause()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AxVLCPlugin1.stop()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
MsgBox("Playing: " & AxVLCPlugin1.Playing)
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Button1.Text = "Load file"
Button2.Text = "Play"
Button3.Text = "Pause"
Button4.Text = "Stop"
Button5.Text = "Check if playing"
End Sub
End Class

Re: Bug, the property Playing returns incorrect value

Posted: 22 Feb 2009 15:40
by RĂ©mi Denis-Courmont
VLC is threaded. The value you get from IsPlaying was correct "a certain small amount of time in the past". There is no way to get the correct value unless you lock the input thread, which requires direct access to libvlccore.dll (and will crash VLC if you gets threading wrong).