Search code examples
iosiphonehtmlaudioicecast

Icecast Live Stream Audio to iPhone


I have a very similar question to Play a Shoutcast Stream on iPhone with HTML5, but with a few differences...

I have an Icecast server running on Ubuntu 14.04 LTS, streaming an mp3. The setup follows Icecast's documentation exactly, is linked from an <audio> HTML5 tag on a website running on AWS EC2 and works in my desktop / laptop browser.

However, when I try to load the same website in iOS, on either my iPhone or my iPad, the HTML5 audio player loads, shows "Loading..." for several minutes, then either displays nothing or "Error".

The HTML5 code is as follows:

<audio controls>
  <source src="http://xx.xx.xx.xx:8000/example1.mp3" type="audio/mpeg" />
</audio>

Suggestions or ideas as to why this doesn't work in iOS?


Solution

  • I finally got this resolved, but realized I never posted an answer.

    I had to set the <audio> src value to the streaming mount point found in my icecast.xml file.

    So, in my icecast.xml file, I have:

    <!-- You may have multiple <listener> elements -->
    <listen-socket>
        <port>8000</port>
        <bind-address>123.456.789.012</bind-address>
        <shoutcast-mount>/stream</shoutcast-mount>
    </listen-socket>
    

    Thus, my HTML5 <audio> tag became:

    <audio src="http://123.456.789.012:8000/stream" />
    

    For good measure, I also included the mime_type of audio/mpeg and controls to the <audio> tag, though these are not required.