3

Has anyone come across a software that can dynamically stream an arbitrary source identified by an HTTP URL.

I am looking for a server based software that can expose a RESTful interface to take in the definition of the playlist and respond back with a stream URL, that would playback the playlist. The sound files in the playlist are located on a different system accessible via HTTP.

I did take a look at liquidsoap project, but couldnt figure out how to wrap that into a RESTful webservice.

Brad
  • 159,648
  • 54
  • 349
  • 530
ϹοδεMεδιϲ
  • 2,790
  • 3
  • 33
  • 54
  • You want the playlist (of arbitrary audio files hosted on HTTP servers) to be played back on the server and assembled into a stream for playback at the client? – Brad Nov 15 '11 at 18:27
  • @Brad, Yes, thats correct. Exactly what I am after. I also need to transcode any audio format into low bandwidth MP3, but that is secondary. – ϹοδεMεδιϲ Nov 15 '11 at 21:09
  • 1
    If I were you, I'd wrap something up with Ices and then use Icecast/SHOUTcast for the server. It already does all of this. You'd just need to call it from some script on your web server. – Brad Nov 15 '11 at 21:23
  • Liquidsoap *does* provide http get/post etc handlers, see here: http://savonet.sourceforge.net/doc-svn/harbor_http.html But as the answer below says you may want to write some of this in another language and call out from Liquidsoap if necessary. – freedrull Mar 24 '13 at 18:05

1 Answers1

2

It would be quite a hassle to implement a RESTful server in liquidsoap. I would build the RESTful webservice in whatever "ordinary" web programming language, like PHP, and then let liquidsoap call the same service to get the tracks/files. In this example, a GET request to http://127.0.0.1/next should return one http url to a mp3/ogg/whatever.

(Example code for liquidsoap version 1.0 - this example will not run on earlier 0.x-something versions)

def autopilot() =
  def result()
    result =
      list.hd(
        get_process_lines('curl http://127.0.0.1/next')
      )
    request.create(result)
  end
  audio_to_stereo(request.dynamic(result))
end

radio =
  mksafe(
    autopilot()
  );

output.icecast(%mp3(samplerate=44100, stereo=true, bitrate=128),
  host="127.0.0.1",
  port=8000,
  password="secretpassword",
  mount="radio.mp3",
  radio
);

In this example, you would need an icecast2 server to send the stream to.

Alfred Godoy
  • 1,045
  • 9
  • 19