Faceți căutări pe acest blog

marți, 18 august 2015

Using Videolan (VLC) ActiveX to play stream media (2)

VLC media player offers two ActiveX.
The second version, is the recommended one, and is more powerful and flexible, yet is still very easy to be used.

Here is the same problem, solved with the second ActiveX.
In addition, by pressing SPACE the song is toggled between pause and play.

*************
* Begin code
*************
PUBLIC oform
oform=CREATEOBJECT("myform")
oform.Show

DEFINE CLASS myform AS form
    Height = 600
    Width = 850
    keypreview = .T. && to allow to your form to intercept the keyboard activity
    ADD OBJECT cmd as commandbutton WITH autosize = .T., caption = 'Click and Play'
    ADD OBJECT vlc AS olecontrol WITH top = 50, Height = 600, Width = 800, OleClass = "VideoLAN.VLCPlugin.2"
    PROCEDURE cmd.Click
        lnId = ThisForm.vlc.OBJECT.playlist.add("https://www.youtube.com/watch?v=-1lj0mZDrIw")
        ThisForm.vlc.OBJECT.playlist.play()

        ThisForm.vlc.SetFocus()
    ENDPROC
    PROCEDURE keypress
        LPARAMETERS nkey,nshift
        IF nkey = 32 && when SPACE is pressed
            This.vlc.OBJECT.playlist.togglePause && toggles between pause and play
        ENDIF
    ENDPROC
ENDDEFINE
*************
* End code
*************


https://wiki.videolan.org/Documentation:WebPlugin/

Related posts
http://praisachion.blogspot.com/2015/08/using-videolan-vlc-activex-to-play_18.html
http://praisachion.blogspot.com/2015/08/using-videolan-vlc-activex-to-play.html

Niciun comentariu:

Trimiteți un comentariu