VLC Fehler

  • Hallo
    da ich keine Lust habe den VLC Player immer offen zu haben dachte ich mach es doch anders

    [autoit]


    #include <Constants.au3>
    $file="http://webradio.antenne.de/antenne/webradio/ant_mp3.m3u" ; change this to a file that exists on your system

    [/autoit][autoit][/autoit][autoit]

    $vlc=ObjCreate("VideoLAN.VLCPlugin.1")
    if @error then
    msgbox(0,"Error","Unable to create VLC object")
    exit
    endif
    ;~ msgbox(0,"",$vlc.versioninfo) ; uncomment this line if you'd like confirmation that we're successfully communicating with VLC

    [/autoit][autoit][/autoit][autoit]

    dim $options[1]
    $options[0]=":vout-filter=deinterlace"
    enum $VLCPlayListInsert=00000001,$VLCPlayListReplace=00000002,$VLCPlayListAppend=00000004,$VLCPlayListGo=00000009,$VLCPlayListCheckInsert=00000010

    [/autoit][autoit][/autoit][autoit]

    $vlc.addTarget($file, $options,$VLCPlayListGo,0)

    [/autoit]


    es wird auch Musik gespielt
    aber es kommt ein Windows Fehler .

    Hat wer eine Idee ?

    • Offizieller Beitrag

    Hallo!

    Also ich hab früher mal ein interen vlc player geschrieben..
    Kannst ja mal reingucken:

    ;Main

    Spoiler anzeigen
    [autoit]

    ;#NoTrayIcon
    #include <GUIConstants.au3>
    #include <vlc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $msg, $btnVideoPause, $btnSetStatus, $btnVideoPlay, $btnVideoStop, $inputVideoTime, $inputVideoTotal, $arr[1]

    [/autoit] [autoit][/autoit] [autoit]

    If $cmdline[0] = 0 Then
    Global $src[2] = ["d:\video\Fun\James\Ready6.mpg", "d:\video\Fun\James\MVI_0549.AVI"]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($src) - 1
    ShellExecute(@ScriptFullPath," "&FileGetShortName($src[$i]),@ScriptDir,"run")
    Next
    Exit
    Else
    $src = $cmdline[1]
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;; Settings ;;;;;;;;;;;;;;;;;;;;;;
    $autoplay = "False"
    $autoloop = "False"
    $left = -2
    $top = -2
    $width = @DesktopWidth + 2
    $height = @DesktopHeight + 2

    [/autoit] [autoit][/autoit] [autoit]

    $wl = WinList()
    For $i = 1 To $wl[0][0]
    If $wl[$i][0] <> "" And $wl[$i][0] <> "Embedded 0715" And BitAND(WinGetState($wl[$i][1]), 2) Then
    ReDim $arr[UBound($arr) + 1]
    $arr[UBound($arr) - 1] = $wl[$i][1]
    WinSetState($wl[$i][1], "", @SW_HIDE)
    EndIf
    Next
    ;;;;;;;;;;;;;;;;;;;;;; Main GUI ;;;;;;;;;;;;;;;;;;;;;;
    $winMain = GUICreate("Embedded 0715", @DesktopWidth + 2, @DesktopHeight + 2, -2, -2, $WS_POPUP, $WS_EX_TOPMOST)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetBkColor(0)

    [/autoit] [autoit][/autoit] [autoit]

    $ret = _GUICtrlCreateVLC ("vlcGUI", $src, $autoplay, $autoloop, $left, $top, $width, $height)
    GUICtrlSetState($ret[0],$GUI_HIDE)
    $oVLC = $ret[1]

    [/autoit] [autoit][/autoit] [autoit]

    $pic = GUICtrlCreatePic("d:\internet\foren\Profil\glow\gtaspider_glo128.jpg",(@DesktopWidth/2)-64,(@DesktopHeight/2)-64,128,128)
    $lab = GUICtrlCreateLabel(StringTrimLeft($src,StringInStr($src,"\",-1,-1)),20,20,@DesktopWidth-20,40)
    GUICtrlSetFont(-1,16,800,0)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW) ; Show the GUI
    Sleep(500)
    GUISetState(@SW_MINIMIZE) ; Show the GUI

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    If WinActive($winMain) Then ExitLoop
    Sleep(50)
    WEnd
    GUICtrlDelete($pic)
    _VLCMediaPlay ($oVLC)
    GUISetState(@SW_SHOW) ; Show the GUI
    Sleep(100)
    GUICtrlSetState($ret[0],$GUI_SHOW)
    ; Main Loop
    Do
    ; Update inputfields when playing
    ;~ $mediaPosition = _VLCMediaGetPosition($oVLC)
    ;~ GUICtrlSetData($inputVideoTime, $mediaPosition)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ $mediaLength = _VLCMediaGetLength($oVLC)
    ;~ GUICtrlSetData($inputVideoTotal, $mediaLength)

    [/autoit] [autoit][/autoit] [autoit]

    ; Get message from GUI
    $msg = GUIGetMsg()
    If Not WinActive($winMain) Then _Stop()
    ;~ Select
    ;~ Case $msg = $btnSetStatus
    ;~ If GUICtrlGetState($vlcGUI) == 96 Then
    ;~ GUICtrlSetState($vlcGUI, $GUI_SHOW)
    ;~ Else
    ;~ GUICtrlSetState($vlcGUI, $GUI_HIDE)
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;~ Case $msg = $btnVideoPlay
    ;~ _VLCMediaPlay($oVLC)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ If @error Then
    ;~ MsgBox(16, "Error", "An error occured (" & @error & ")")
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;~ Case $msg = $btnVideoPause
    ;~ _VLCMediaTogglePause($oVLC)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ If @error Then
    ;~ MsgBox(16, "Error", "An error occured (" & @error & ")")
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;~ Case $msg = $btnVideoStop
    ;~ _VLCMediaStop($oVLC)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ If @error Then
    ;~ MsgBox(16, "Error", "An error occured (" & @error & ")")
    ;~ EndIf
    ;~ EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    Until $msg = $GUI_EVENT_CLOSE

    [/autoit] [autoit][/autoit] [autoit]

    Func _Stop()
    _VLCMediaTogglePause ($oVLC)

    While 1
    If WinActive($winMain) Then ExitLoop
    Sleep(50)
    WEnd
    _VLCMediaPlay ($oVLC)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    For $i = 1 To UBound($arr) - 1
    WinSetState($arr[$i], "", @SW_SHOW)
    Next
    EndFunc ;==>OnAutoItExit

    [/autoit]

    VLC.au3 (nicht von mir!!)

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <ie.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Create GUI object ;;;;;;;;;;;;;;;;;;;;;;;
    Func _GUICtrlCreateVLC($returnVar, $src, $autoplay, $autoloop, $left, $top, $width, $height)

    [/autoit] [autoit][/autoit] [autoit]

    ; First we create an explorer instance
    $oIE = ObjCreate("Shell.Explorer.2")

    [/autoit] [autoit][/autoit] [autoit]

    ; Success ?
    If Not IsObj($oIE) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Create ActiveX object
    $oIEActiveX = GUICtrlCreateObj($oIE, $left, $top, $width+4, $height+4)
    ; Could we create the control ?
    If Not $oIEActiveX Then
    setError(2)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Check if file exists
    If Not FileExists($src) Then
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Convert path to media
    $src = StringReplace($src, "\", "/")
    $src = StringReplace($src, " ", "%20")

    [/autoit] [autoit][/autoit] [autoit]

    ; Create body
    $html = chr(9) & chr(9) & "<style type=" & chr(34) & "text/css" & chr(34) & ">" & @CRLF & _
    @CRLF & _
    chr(9) & chr(9) & chr(9) & "html, body, vlc {" & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & "margin: 0px;" & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & "padding: 0px;" & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & "overflow: hidden;" & @CRLF & _
    chr(9) & chr(9) & chr(9) & "}" & @CRLF & _
    @CRLF & _
    chr(9) & chr(9) & "</style>" & @CRLF & _
    @CRLF & _
    chr(9) & chr(9) & "<object classid=" & chr(34) & "clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" & chr(34) & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & "codebase=" & chr(34) & "http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" & chr(34) & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & "style=" & chr(34) & "left: 0px; top: 0px; width: " & $width & "px; height: " & $height & "px;" & chr(34) & @CRLF & _
    chr(9) & chr(9) & chr(9) & chr(9) & " id=" & chr(34) & "vlc" & chr(34) & " events=" & chr(34) & "True" & chr(34) & ">" & @CRLF & _
    @CRLF & _
    chr(9) & chr(9) & "<param name=" & chr(34) & "src" & chr(34) & " value=" & chr(34) & "file:///" & $src & chr(34) & " />" & @CRLF & _
    chr(9) & chr(9) & "<param name=" & chr(34) & "StartTime" & chr(34) & " value=" & chr(34) & "0.5" & chr(34) & " />" & @CRLF & _
    chr(9) & chr(9) & "<param name=" & chr(34) & "autoloop" & chr(34) & " value=" & chr(34) & $autoloop & chr(34) & " />" & @CRLF & _
    chr(9) & chr(9) & "<param name=" & chr(34) & "AutoPlay" & chr(34) & " value=" & chr(34) & $autoplay & chr(34) & " />" & @CRLF & _
    @CRLF & _
    chr(9) & chr(9) & "</object>" & @CRLF

    [/autoit] [autoit][/autoit] [autoit]

    ; Set content
    _IENavigate($oIE, "about:blank")
    _IEDocWriteHTML($oIE, $html)

    [/autoit] [autoit][/autoit] [autoit]

    ; Get object to embedded player
    $oVLC = _IEGetObjByName($oIE, "vlc")

    [/autoit] [autoit][/autoit] [autoit]

    Assign($returnVar, $oIEActiveX, 2)
    Local $ret[2]
    $ret[0] = $oIEActiveX
    $ret[1] = $oVLC
    ; Return handle for VLC object
    Return $ret
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Play Media ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaPlay(ByRef $oVLC)
    ; Check if media is playing
    ;_VLC

    [/autoit] [autoit][/autoit] [autoit]

    ; Play media
    $oVLC.play()

    [/autoit] [autoit][/autoit] [autoit]

    ; Return
    setError(0)
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Pause media ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaTogglePause(ByRef $oVLC)
    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Toggle pause
    $oVLC.pause()

    [/autoit] [autoit][/autoit] [autoit]

    ; Return
    setError(0)
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Stop media ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaStop(ByRef $oVLC)
    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Stop playing
    $oVLC.stop()

    [/autoit] [autoit][/autoit] [autoit]

    ; Return
    setError(0)
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Set position ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaSetPosition($oVLC, $seconds)
    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Set position
    _VLCMediaSetParameter($oVLC, 5, 120)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;; NOTE: THESE ARE ROUGH ESTIMATES; THE LENGTH OF THE MEDIA IS FLOORED ;;;;
    ;;;; BY THE ACTIVEX COMPONENT..... (e.g. 1:36:04.567 becomes 1:36:04) ;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Get total length for media ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaGetLength(ByRef $oVLC)
    ; Get length
    Return _VLCMediaGetParameter($oVLC, 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Get info for current position ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaGetPosition(ByRef $oVLC, $type=2)
    ; Check for correct parameter
    If Not IsInt($type) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $type == 1 Then
    Return _VLCMediaGetParameter($oVLC, 11)
    Elseif $type == 2 Then
    Return _VLCMediaGetParameter($oVLC, 8)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Get player status ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaIsPlaying(ByRef $oVLC)
    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Return _VLCMediaGetParameter($oVLC, 10)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Get player parameter ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaGetParameter(ByRef $oVLC, $param = 0)
    ;;; id name type description
    ;;; 0 - Array Return all parameters
    ;;; 1 Length Integer Returns length of the current clip.
    ;;; 2 playlistCount Returns the count of items in the playlist
    ;;; 3 playlistIndex Returns the index of the current item in the playlist.
    ;;; 4 AutoLoop Boolean Determines if the player should automatically loop when it finishes the current playlist.
    ;;; 5 AutoPlay Boolean Determines if the player should start playing a new file/playlist immediately upon being loaded.
    ;;; 6 Volume Integer Current volume (scaled from 0 to 100)
    ;;; 7 MRL String Presumably returns the MRL of the currently loaded file.
    ;;; 8 Time Integer Time elapsed in seconds playing current MRL, 0 for live feed
    ;;; 9 showdisplay Boolean show/hide control viewport
    ;;; 10 Playing Boolean Returns whether some MRL is playing
    ;;; 11 Position 'real' Playback position within current MRL, scaled from 0.0 to 1.0. Live feed returns 0.0
    ;;; 12 VersionInfo String Returns version and build information.
    ;;;
    ;;; THERE'S A PROBLEM WITH #9 ==> SHOWDISPLAY NOT WORKING!!!

    [/autoit] [autoit][/autoit] [autoit]

    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Check if parameter is correct
    If Not IsInt($param) Then
    setError(2)
    Return(0)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Return parameter(s)
    Select
    Return $parameters
    Case $param = 1
    If Not IsInt($oVLC.Length()) Then
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $oVLC.Length() == -20 Then
    Return 0
    Else
    Return $oVLC.Length()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 8
    ; Check return
    $length = _VLCMediaGetParameter($oVLC, 1)
    ;Sleep(1) ; When use sleep(1), AutoIT script crashes less often
    $position = _VLCMediaGetParameter($oVLC, 11)

    [/autoit] [autoit][/autoit] [autoit]

    $pos = $position*$length
    $pos = StringFormat("%.2f", $pos)

    [/autoit] [autoit][/autoit] [autoit]

    Return $pos

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 10
    If Not IsInt($oVLC.playing()) Then
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $oVLC.playing() == -1 Then
    ; Playing
    Return 1
    Else
    ; Stopped/paused
    Return 2
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 11
    ; Check return
    If Not IsNumber($oVLC.Position()) Then
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    return $oVLC.Position()

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;;;;;;;;;;;;;;;;;;;;;;; Set player parameter ;;;;;;;;;;;;;;;;;;;;;;;
    Func _VLCMediaSetParameter(ByRef $oVLC, $param = 0, $value = "")
    ;;; id name type description
    ;;;
    ;;; 1 AutoLoop Boolean Determines if the player should automatically loop when it finishes the current playlist.
    ;;; 2 AutoPlay Boolean Determines if the player should start playing a new file/playlist immediately upon being loaded.
    ;;; 3 Volume Integer Current volume (scaled from 0 to 100)
    ;;; 4 MRL String Presumably returns the MRL of the currently loaded file.
    ;;; 5 Time Integer Time elapsed in seconds playing current MRL, 0 for live feed\
    ;;; 6 showdisplay Boolean show/hide control viewport
    ;;; 7 Position 'real' Playback position within current MRL, scaled from 0.0 to 1.0. Live feed returns 0.0

    [/autoit] [autoit][/autoit] [autoit]

    ; Check if object exists
    If Not IsObj($oVLC) Then
    setError(1)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Return parameter(s)
    Select
    Case $param = 1
    If IsBool($value) Then
    $oVLC.AutoLoop = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 2
    If IsBool($value) Then
    $oVLC.AutoPlay = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 3
    If IsInt($value) And $value >= 0 And $value <= 100 Then
    $oVLC.Volume = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 4
    If IsString($value) Then
    $oVLC.MRL = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 5
    If IsInt($value) Then
    $oVLC.Time = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 6
    If IsBool($value) Then
    $oVLC.showdisplay = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $param = 7
    If IsNumber($value) And $value >= 0 And $value <= 1.0 Then
    $oVLC.Position = $value
    Else
    setError(3)
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit]

    Mfg Spider