Jump to content
goober10

VLC Player UDF

Recommended Posts

goober10

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
ptrex

@

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
goober10

@

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
MaximusCZ

Sory for reviving old topics, but after hours of googling I cant get it.
When I try to run the code, I get "Invalid class string", err.number is 800401F3, script line 20

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

I tried to google new way, only found "VideoLAN.VLCPlugin.1", which is not working either, and then point to direction of using "autoitObject.au3" and "_autoitobject_createobjectex()", which I dont understand, isnt working out of the box (requires more parameters) and would likely break rest of the script above.

Can anyone please enlighten me how to create an vlc object these days?

Share this post


Link to post
Share on other sites
water

This thread is > 10 years old. A lot has changed since in VLC and AutoIt. I wouldn't expect this old code to work.
Did you have a look at the VLC UDFs described in the wiki?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
MaximusCZ
Posted (edited)

I must have missed the UDF. The second one uses same COM object as I have problems with, the first one is giving me error when I try to "_IEDocWriteHTML($oIE, $html)"

error: _GUICtrlVLC_Create failed. The most likely cause is that you dont have VLC installed. Make sure VLC, and the ActiveX component, is installed.
I just downloaded VLC and made a fresh install to make sure all is up to date. I have no idea how to check if ActiveX is installed, those are the waters I never stumbled upon. I tried to check inside VLC for plugins (no trace of ActiveX installed nor not), tried to google checks if I have ActiveX installed, but to no avail.

When I set GUISetState(@SW_SHOW) right after GUI is created, I can see it creates IE page OK and navigate to about:blank (even some random site loads ok), but when the "write html" function triggers I see only black cross in a box (failed activex?).

Is ActiveX one plugin, or is it class of plugins and I need to have VLCs one speciffically? How can I make sure I have it running, or that its enabled? How can I enable it if I do not?

 

Ah, I needed to install 64 bit version, now the installator asks if to install activeX too

Ah, And when I selected to compile au3 script in 64 bit it works! finally seeing yellow white cone in embeded window. Thanks!

 

Edited by MaximusCZ

Share this post


Link to post
Share on other sites
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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

×