Jump to content

VLC Player UDF


Recommended Posts

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!

Link to comment
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

Link to comment
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!

Link to comment
Share on other sites

  • 10 years later...

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?

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...