Sign in to follow this  
Followers 0
goober10

VLC Player UDF

3 posts in this topic

Does anyone know how I can place a VLC player within a GUI of a program. I can do this with Windows Media Player, however, I would prefer VLC simply because it is more universal with file formats.

Thanks A Bunch!

Share this post


Link to post
Share on other sites



@

I did give it a try sometime ago, but not got very far.

This will give you a startingpoint.

opt("GUIOnEventMode", 1)
#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

;VLCPlaylistMode
Const $VLCPlayListInsert = 1
Const $VLCPlayListInsertAndGo = 9
Const $VLCPlayListReplace = 2
Const $VLCPlayListReplaceAndGo = 10
Const $VLCPlayListAppend = 4
Const $VLCPlayListAppendAndGo = 12
Const $VLCPlayListCheckInsert = 16


; Initialize error handler 
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

; ---------------------------------- Declare objects -------------------------------
$oVLC = ObjCreate("VideoLAN.VLCPlugin") ; Default to version less Object


With $oVLC
      .AutoLoop        =   0   ;False
      .AutoPlay        =   0   ;False
      .MRL             =   ""
      .Visible         =   -1  ;True
      .Volume          =   50
EndWith



; -------------------------------------------- Main Gui ---------------------------------
$hGui = GuiCreate("VLC Viewer", 802, 590,-1, -1, Bitor($WS_SYSMENU, $WS_VISIBLE))
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIeventClose")


$oVLC_Object = GUICtrlCreateObj ($oVLC, 10, 70 , @DesktopWidth-60 , 660)
GUICtrlSetStyle ( $oVLC_Object,  $WS_VISIBLE )
;GUICtrlSetResizing ($oVLC_Object,$GUI_DOCKAUTO)        ; $GUI_DOCKAUTO Auto Resize Object

GuiSetState()



While 1
    Sleep(100)
WEnd

Func GUIeventClose()
    Exit
EndFunc   ;==>GUIeventClose

;This is custom error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

regards

ptrex

Share this post


Link to post
Share on other sites

@

I did give it a try sometime ago, but not got very far.

This will give you a startingpoint.

opt("GUIOnEventMode", 1)
#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

;VLCPlaylistMode
Const $VLCPlayListInsert = 1
Const $VLCPlayListInsertAndGo = 9
Const $VLCPlayListReplace = 2
Const $VLCPlayListReplaceAndGo = 10
Const $VLCPlayListAppend = 4
Const $VLCPlayListAppendAndGo = 12
Const $VLCPlayListCheckInsert = 16


; Initialize error handler 
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

; ---------------------------------- Declare objects -------------------------------
$oVLC = ObjCreate("VideoLAN.VLCPlugin") ; Default to version less Object


With $oVLC
      .AutoLoop        =   0   ;False
      .AutoPlay        =   0   ;False
      .MRL             =   ""
      .Visible         =   -1  ;True
      .Volume          =   50
EndWith



; -------------------------------------------- Main Gui ---------------------------------
$hGui = GuiCreate("VLC Viewer", 802, 590,-1, -1, Bitor($WS_SYSMENU, $WS_VISIBLE))
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIeventClose")


$oVLC_Object = GUICtrlCreateObj ($oVLC, 10, 70 , @DesktopWidth-60 , 660)
GUICtrlSetStyle ( $oVLC_Object,  $WS_VISIBLE )
;GUICtrlSetResizing ($oVLC_Object,$GUI_DOCKAUTO)        ; $GUI_DOCKAUTO Auto Resize Object

GuiSetState()



While 1
    Sleep(100)
WEnd

Func GUIeventClose()
    Exit
EndFunc   ;==>GUIeventClose

;This is custom error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

regards

ptrex

DUDE! That is awesome, works perfectly. You are the man!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0