How to stream online radio with Phonegap?

vasion picture vasion · Jun 23, 2011 · Viewed 8k times · Source

I have hard time getting an iphone app built on top of phonegap to stream online radio station. It should be possible but doing

try {
     var myaudio = new Media('http://domain.com:8000/ices',function(e)  
          {alert(e);},function(e){alert(e);});
                myaudio.play();
        } catch (e) {
                 alert('no audio support!');
     }

does not play the stream. No error either. The app just freezes and no error in the Xcode log console.

How should i approach this?

Answer

Dalibor Vlaho picture Dalibor Vlaho · Apr 2, 2012

I've done this by using HTML5 ... Simply create an AUDIO instance and use SRC to call URL STREAM. Audio player will be visible but you can hide it easily!