.mp3 aus dem internet abspielen

  • /edit: bitte in das richtige forum moven :)


    Hallo,
    ich habe gerade dieses Script erstellt:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Sound.au3>

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

    $aSound = _SoundOpen(@ScriptDir & "\test.mp3")

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

    $Form1 = GUICreate("Form1", 194, 58, 192, 124)
    $Button1 = GUICtrlCreateButton("Ton an", 16, 16, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ton aus", 104, 16, 75, 25, 0)
    GUISetState()

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

    _SoundPlay($aSound, 0)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _SoundResume($aSound)
    Case $Button2
    _SoundPause($aSound)
    EndSwitch
    WEnd

    [/autoit]

    jetzt will ich allerdings, dass eine datei (http://87.230.53.70/iloveradio1.mp3) aus dem Internet abgespielt wird, dies funktioniert mit "_soundplay" allerdings nicht...
    diese Datei gehört zu einem online radio...

    Wie kann ich die abspielen lassen?
    (ich hab gehört, dass soll mit BASS.au3 funktionieren, allerdings hab ich davon keine ahnung und kapier das auch nicht wirklich...)

    Danke im Vorraus :D

  • So:

    Spoiler anzeigen
    [autoit]

    #include "Bass.au3"

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

    _BASS_Startup(@ScriptDir & '\bass.dll') ;Startup Bass.dll
    _BASS_Init(0, -1, 44100, 0) ;Init Bass.dll
    If @error Then ;All correct?
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
    EndIf

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

    $stream = "http://80.237.157.64/iloveradio1.mp3" ;Your Stream
    $MusicHandle = _BASS_StreamCreateURL($stream, 0, 1) ;Create Stream
    OnAutoItExitRegister("_Exit") ;If Exit then call "_Exit"

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

    If @error Then ;Check if we opened the URL correctly.
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    _BASS_ChannelPlay($MusicHandle, 1) ;Play Stream

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

    While 1
    Sleep (10)
    WEnd

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

    Func _Exit()
    _Bass_Free()
    Exit
    EndFunc

    [/autoit]

  • danke für die schnelle antwort, aber wie mach ich das dann so, dass man das stoppen und auch wieder starten kann (siehe oben in meinem script)

  • Moment ich probiers mal aus:
    Edit:

    Spoiler anzeigen
    [autoit]

    #include "Bass.au3"
    ;~ #include <GUIConstantsEx.au3>

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

    _BASS_Startup(@ScriptDir & '\bass.dll') ;Startup Bass.dll
    _BASS_Init(0, -1, 44100, 0) ;Init Bass.dll
    If @error Then ;All correct?
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
    EndIf

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

    $stream = "http://80.237.157.64/iloveradio1.mp3" ;Your Stream
    $MusicHandle = _BASS_StreamCreateURL($stream, 0, 1) ;Create Stream
    OnAutoItExitRegister("_Exit") ;If Exit then call "_Exit"

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

    If @error Then ;Check if we opened the URL correctly.
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    $Form1 = GUICreate("Form1", 194, 58, 192, 124)
    $Button1 = GUICtrlCreateButton("Play", 16, 16, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Pause", 104, 16, 75, 25, 0)
    GUISetState()

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

    _BASS_ChannelPlay($MusicHandle, 1) ;Play Stream

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3 ;ersetzt $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _BASS_ChannelPlay($MusicHandle, 0)
    Case $Button2
    _BASS_ChannelPause($MusicHandle)
    EndSwitch
    WEnd

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

    Func _Exit()
    _Bass_Free()
    Exit
    EndFunc

    [/autoit]
  • Ich habs gerade so:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include "Bass.au3"

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

    $Form1 = GUICreate("Form1", 194, 58, 192, 124)
    $Button1 = GUICtrlCreateButton("Ton an", 16, 16, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ton aus", 104, 16, 75, 25, 0)
    GUISetState()

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

    _BASS_Startup(@ScriptDir & '\bass.dll') ;Startup Bass.dll
    _BASS_Init(0, -1, 44100, 0) ;Init Bass.dll
    If @error Then ;All correct?
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
    EndIf

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

    $stream = "http://80.237.157.64/iloveradio1.mp3" ;Your Stream
    $MusicHandle = _BASS_StreamCreateURL($stream, 0, 1) ;Create Stream
    OnAutoItExitRegister("_Exit") ;If Exit then call "_Exit"

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

    If @error Then ;Check if we opened the URL correctly.
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _BASS_ChannelPlay($MusicHandle, 1) ;Play Stream
    Case $Button2
    _Bass_Free()
    EndSwitch
    WEnd

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

    Func _Exit()
    _Bass_Free()
    Exit
    EndFunc

    [/autoit]

    sobald man es aber gestoppt hat, lässt es sich nichtmehr starten :/