Jump to content

Playing steaming music.


Recommended Posts

The sound functions don't let you play streaming music. So I decided to try something different. I started a method which worked somewhat. I connected to a Shoutcast server and saved the stream to a file then I used the sound functions to play the file and repeated the process. The only problem is Shoutcast, like most streaming music servers, have a function to send you the same data over and over again if the connection is interrupted. The connection is interrupted every time the file is played. So I'm trying a new method where the sound is piped directly into Autoit. below is all I have at the moment.

TCPStartup()
$Socket = TCPConnect("64.92.199.69",8240)
TCPSend($Socket,"GET / HTTP/1.0"&@CRLF&"Host: 64.92.199.69"&@CRLF&"User-Agent: WinampMPEG/5.52"&@CRLF&"Accept: */*"&@CRLF&"Icy-MetaData:1"&@CRLF&"Connection: close"&@CRLF&@CRLF)

While 1
    $Recv = TCPRecv($Socket,2048)
Wend

From there I'm stumped.

Anyone wanna take a crack at it and collaborate on it?

[size="1"]Please stop confusing "how to" with "how do"[/size]

Link to comment
Share on other sites

Tried it. It would load the object but it wouldn't play. I would really like to see this with a TCP function though since it would be more flexible.

[size="1"]Please stop confusing "how to" with "how do"[/size]

Link to comment
Share on other sites

Yes I know how to do that. My issue is that it won't load the video in the embedded object in autoit. I also don't want there to be a requirement to have WMP installed on a persons system. Personally I don't have WMP installed unless I'm doing something that requires it such as the WMP object.

[size="1"]Please stop confusing "how to" with "how do"[/size]

Link to comment
Share on other sites

this actually reminds me of a program that i was going to write a while back.

my dad owns a restaurant and i have streaming radio going to the store speakers for music, but the station keeps closing, it just sparked me that i can use autoit to detect if it stops then reconnect, or play another station if there is no connection.

let me know what you come up with, i might have to look back into this project.

Link to comment
Share on other sites

With the new feature to send binary streams via STDIO you can do a whole bunch of things with the VLC Player (link).

Sample:

$f_MediaFile = FileOpen("C:\somemovie.avi",0+16)
$p_VLC = Run("vlc.exe -","",@SW_MAXIMIZE,1) ; the "-" as parameter tells VLC to take STDIO as input

While 1
    $buffer = FileRead($f_MediaFile,1024)
    If @error = -1 Then ExitLoop
    StdinWrite($p_VLC,$buffer)
Wend

FileClose($f_MediaFile)

Instead of streaming from a file you can send the TCP buffer to VLC.

Just make sure you use the latest Autoit version (v3.2.12.0).

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...