Jump to content



Photo

VLC Media Player


  • Please log in to reply
12 replies to this topic

#1 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 15 March 2009 - 08:52 PM

VLC Media Player

Many times I have seen attemps to get the famous VLC Payer into AU3.

VLC media player - the cross-platform media player and streaming server
VLC media player is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, ...) as well as DVDs, VCDs, and various streaming protocols. It can also be used as a server to stream in unicast or multicast in IPv4 or IPv6 on a high-bandwidth network

I seemed always to crash the GUI when using the VLC ActiveX object ?

Before running the script download and install the VLC Player

AutoIt         
opt("GUIOnEventMode", 1) #include <GUIConstantsEX.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> ;VLCPlaylistMode Const $VLCPlayListInsert = 1 Const $VLCPlayListReplace = 2 Const $VLCPlayListAppend = 4 Const $VLCPlayListGo = 8 Const $VLCPlayListInsertAndGo = 9 Const $VLCPlayListReplaceAndGo = 10 Const $VLCPlayListAppendAndGo = 12 Const $VLCPlayListCheckInsert = 16 ; Initialize error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; ---------------------------------- Declare objects ------------------------------- $oVLC = ObjCreate("VideoLAN.VLCPlugin.1") ; -------------------------------------------- Main Gui --------------------------------- $hGui = GuiCreate("VLC Viewer", 500, 390,-1, -1, Bitor($WS_OVERLAPPEDWINDOW,$WS_VISIBLE, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIeventClose") $bSelect = GUICtrlCreateButton("Select ... ", 10, 20, 70)          GUICtrlSetOnEvent(-1, "_SelectFile") ;$oVLC_Object = GUICtrlCreateObj ($hGui, 10, 70 , 700 , 460) ;GUICtrlSetStyle ( $oVLC_Object, $WS_VISIBLE ) ;GUICtrlSetResizing ($oVLC_Object,$GUI_DOCKAUTO)        ; $GUI_DOCKAUTO Auto Resize Object GuiSetState() $size = WinGetPos("[active]") While 1     Sleep(100) WEnd Func _SelectFile ()         $File = FileOpenDialog("Select a movie File ", @MyDocumentsDir & "", "Images (*.flv;*.swf;*.wmv;*.avi;*.*)", 1)     If @error Then         MsgBox(4096,"","No File chosen ...")         Return     Else         Sleep(100)         _StartPlay($File)     EndIf EndFunc Func _StartPlay($hFile)     With $oVLC         ;.AddTarget ($hFile, Default, $VLCPlayListInsert, 0)         .MRL = $hFile         .AutoLoop = 0 ;False         .AutoPlay = 0 ;False         .Visible = 1 ;True         .Play ()         .Volume = 50     EndWith EndFunc 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


The only way to get it run without crashing is NOT to use the "GUICtrlCreateObj".
The VLC Player creates some kind of own GUI and Control when calling the Object.

This make it hard of course to attach the Control to the parent window.

Some Movie

Attached File  flexdrainwit.zip   4.14MB   713 downloads

Enjoy !!

Regards,

ptrex

Edited by ptrex, 14 September 2012 - 09:46 AM.






#2 FireFox

FireFox

    Liar using Chrome :>

  • Active Members
  • PipPipPipPipPipPip
  • 3,173 posts

Posted 15 March 2009 - 08:57 PM

@ptrex
briliant !! Good job :P and useful COM udf

Cheers, FireFox.
OS : Win XP SP3 / Win 7 SP1 / Win 8 | Autoit version: latest stable / beta

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | What you've done today | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 22 April, 2013 - If you find dead links please send me a PM, do not post in the topics !

#3 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 15 March 2009 - 09:06 PM

@Firefox

You are welcome !!

But it needs lots of improvements.

regards

ptrex

#4 FireFox

FireFox

    Liar using Chrome :>

  • Active Members
  • PipPipPipPipPipPip
  • 3,173 posts

Posted 15 March 2009 - 09:10 PM

@ptrex
Of course, im waiting for this improvements :P

Cheers, FireFox.
OS : Win XP SP3 / Win 7 SP1 / Win 8 | Autoit version: latest stable / beta

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | What you've done today | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 22 April, 2013 - If you find dead links please send me a PM, do not post in the topics !

#5 87yj

87yj

    Seeker

  • Active Members
  • 8 posts

Posted 17 March 2009 - 11:21 PM

I got an error saying "The procedure point VLC_Play could not be located in the dll libvlc.dll

I have VLC 0.98a installed.

err.number # 8007007f
err.lastdllerror 127
err.scriptline 20

#6 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 18 March 2009 - 07:17 PM

@87yj

This means that your system did not install correctly the VLC Player.

try reinstalling it or run this cmd "regsvr32 "C:\Program Files\VideoLAN\VLC\axvlc.dll"

Regards,

ptrex

#7 ghetek

ghetek

    Adventurer

  • Active Members
  • PipPip
  • 106 posts

Posted 20 March 2009 - 02:28 AM

im getting no video when i run your example. i get audio in the background. when thw app starts i get the following error:

errnumber is FFFFFFFF
err.lastdllerror is 0
err.scriptline is 41

#8 ghetek

ghetek

    Adventurer

  • Active Members
  • PipPip
  • 106 posts

Posted 20 March 2009 - 02:29 AM

line 41 is $oVLC_Object = GUICtrlCreateObj ($hGui, 10, 70 , 700 , 460)

#9 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 20 March 2009 - 09:09 AM

@ghetek

I don't see what you mean ?

Rgds

ptrex

#10 fZkFUvA

fZkFUvA

    Newbie

  • Banned (NOT IN USE)
  • 4 posts

Posted 20 March 2009 - 09:20 AM

All this fails to [link snipped] !

Edited by SmOke_N, 20 March 2009 - 09:29 AM.


#11 Dampe

Dampe

    Polymath

  • Active Members
  • PipPipPipPip
  • 231 posts

Posted 20 March 2009 - 10:25 AM

Working well and strong for me.
This is awesome.

Would be nice to see some control features like play pause stop volume or something.

EDIT:

Started to write it into a UDF for my own use

AutoIt         
#include-once Local Const $VLCPlayListInsert = 1 Local Const $VLCPlayListReplace = 2 Local Const $VLCPlayListAppend = 4 Local Const $VLCPlayListGo = 8 Local Const $VLCPlayListInsertAndGo = 9 Local Const $VLCPlayListReplaceAndGo = 10 Local Const $VLCPlayListAppendAndGo = 12 Local Const $VLCPlayListCheckInsert = 16 $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $oVLC = ObjCreate("VideoLAN.VLCPlugin.1") _VLC_Startup() $tFile = FileOpenDialog ("Select media", "", "All files (*.*)") If $tFile <> "" Then     _VLC_OpenFile($tFile) Else     Exit EndIf ;//Demo _VLC_Play() Sleep (5000) _VLC_Pause() Sleep (3000) _VLC_Play() _VLC_SetVolume(5) Sleep (5000) _VLC_SetVolume(100) Sleep (2500) _VLC_SetVolume() Sleep (2500) _VLC_Stop() Func _VLC_Startup($_VLC_AutoLoop=0, $_VLC_AutoPlay=0, $_VLC_Visible=1, $_VLC_Volume=50)     With $oVLC         .AutoLoop        =   $_VLC_AutoLoop         .AutoPlay        =   $_VLC_AutoPlay         .Visible         =   $_VLC_Visible         .Volume          =   $_VLC_Volume     EndWith EndFunc Func _VLC_OpenFile($_VLC_File)         If not FileExists ($_VLC_File) Then         SetError(1)         Return -1     Else         $oVLC.MRL       =   $_VLC_File         Return 1     EndIf     EndFunc Func _VLC_Play()         $oVLC.Play()     EndFunc Func _VLC_Pause()         $oVLC.Pause()     EndFunc Func _VLC_Stop()         $oVLC.Stop()     EndFunc Func _VLC_SetVolume($_VLC_SetVolume=50)         $oVLC.Volume        =   $_VLC_SetVolume     EndFunc 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


Also, is there anyway to make this start full screen by default?

Edited by Dampe, 20 March 2009 - 10:43 AM.

Posted Image

#12 87yj

87yj

    Seeker

  • Active Members
  • 8 posts

Posted 05 April 2009 - 05:36 PM

I think the com support was taken out of VLC 0.9xx can anyone else confirm?

This should work with the older 0.8xx versions

#13 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 05 April 2009 - 09:22 PM

@87yj

I don't think so. Last time used with 0.9.8.1


Regards,

ptrex




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users