Here is a getStream implementation:
def getStream (url: String) = {
Concurrent.unicast[Array[Byte]] { channel =>
WS.url(url).withTimeout(-1).get(headers => Iteratee.foreach[Array[Byte]] { bytes => channel.push(bytes) })
}
}| val audioStream: Enumerator[Array[Byte]] = getStream("http://radio.hbr1.com:19800/ambient.ogg") | |
| val addEchoToOgg =CLI.pipe("sox -t ogg - -t ogg - echo 0.5 0.7 60 1") | |
| def webRadioWithEcho = Action { | |
| Ok.stream(audioStream &> addEchoToOgg) | |
| .withHeaders(CONTENT_TYPE -> "audio/ogg") | |
| } |
Here is a getStream implementation:
def getStream (url: String) = {
Concurrent.unicast[Array[Byte]] { channel =>
WS.url(url).withTimeout(-1).get(headers => Iteratee.foreach[Array[Byte]] { bytes => channel.push(bytes) })
}
}| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
| 0. You just DO WHAT THE FUCK YOU WANT TO. |