Help Playing an HTTP Audio Stream

Discuss any general programming issues here
Post Reply
NathanH
Posts: 140
Joined: Sun Jul 05, 2015 1:29 am
Location: Caldwell, Idaho

Help Playing an HTTP Audio Stream

Post by NathanH »

Hi,

I have a permanent IceCast http stream (mp3 192 kbs) on my local network that I can listen to via, for example, VLC for Linux or on my Android phone. I was hoping to be able to listen to it from within AROS using the httpstreamer and avcodec plugins. I also tried this on Amiga OS39 with same result. The url$ in the following code is how you listen to the IceCast stream from within VLC. The following code says OpenMusic can't find radio.mp3 so its probably looking for a file by that name at the url rather than a stream. Is it possible to listen to the stream this way or am I doing something wrong in the code? Thanks.

NathanH

Code: Select all

@REQUIRE "avcodec"
@REQUIRE "httpstreamer", {UserAgent="Firefox", Timeout=20000}

Function p_Die(msg$)
	DebugPrint("ERROR: " .. msg$)
	End()
EndFunction

Function p_Main()
	Local url$ = "http://192.168.0.29:8000/radio.mp3"
	Local mus

	; If HTTPStreamer+AVCodec are working, OpenMusic() should accept the URL.
	mus = OpenMusic(Nil, url$, {Loader="httpstreamer", "Adapter="avcodec"})
	
	If IsNil(mus)
		p_Die("OpenMusic() failed for: " .. url$)
	EndIf

	PlayMusic(mus)

	; keep running so it can continue streaming
	Repeat
		WaitLeftMouse() ; click to stop (simple demo)
	Until False

	StopMusic(mus)
	CloseMusic(mus)
EndFunction

p_Main()
NathanH
Posts: 140
Joined: Sun Jul 05, 2015 1:29 am
Location: Caldwell, Idaho

Re: Help Playing an HTTP Audio Stream

Post by NathanH »

The BBC example provided in other post does work for a few seconds so ChatGPT and me tried a bunch of things for a whole day to try to figure out why this doesn't. I think that its probably a dead issue until httpstreamer becomes a bit more robust for this type of usage. Thanks.

NathanH
User avatar
jPV
Posts: 746
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Help Playing an HTTP Audio Stream

Post by jPV »

I think the situation is still that these Hollywood things query for the filesize and thus won't work with endless streams.
NathanH
Posts: 140
Joined: Sun Jul 05, 2015 1:29 am
Location: Caldwell, Idaho

Re: Help Playing an HTTP Audio Stream

Post by NathanH »

Thanks, I' sure they'll provide this functionality at some point.

NathanH
Post Reply