Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing php to opening live audio stream on android
    primarykey
    data
    text
    <p>We have shoutcast/icecast audio streams. I'd like to be able to provide a link such as mobiledroid.php on our web site that will open using default player. I've seen this <a href="http://mobile.shoutcaststreaming.us/metal/" rel="nofollow">done on another site</a> so I do know it's possible.</p> <p>I assume it uses php headers and streams via the php file as a stream?</p> <hr> <p>Using Brad's instructions, the android actually gives the option to open with sound player. Nice one.</p> <p>It also plays on WMP through PC but not on the android how the above link plays</p> <pre><code>header("Content-type: audio/mpeg"); header("Transfer-Encoding: chunked"); header("Connection: close"); $sock = fsockopen($streamname,$port); //$streamname is the IP fputs($sock, "GET $path HTTP/1.0\r\n"); //path in my case is /;stream.mp3 fputs($sock, "Host: $ip\r\n"); fputs($sock, "User-Agent: WinampMPEG/2.8\r\n"); fputs($sock, "Accept: */*\r\n"); fputs($sock, "Icy-MetaData:1\r\n"); fputs($sock, "Connection: close\r\n\r\n"); fpassthru($sock); fclose($sock); </code></pre> <p>On the android, it says "Sorry, this player does not support this type of audio file"</p> <hr> <p><strong>Update 2:</strong></p> <p>Removing <code>"Transfer-Encoding"</code> will play on android but as usual will take a long time to begin stream with "Preparing" status due to a live stream not having "Content-Length"</p> <p><code>header("Transfer-Encoding: none");</code> also removed from above code:</p> <p>Quoting Brad:</p> <blockquote> <p>Android 2.3 and later has an issue with Transfer-Encoding set to "none". Removing that hard-set header puts the stream back to chunked Transfer-Encoding. This works great for Android 2.3+. Originally I had disabled chunked encoding as VLC doesn't support it. It also seems that Android 2.2 and older does not support chunked encoding.</p> </blockquote> <p>Noting here that although it works on android, most live streams will take an awful amount of time to begin.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload