Streaming Shoutcast on android

2,993 views
Skip to first unread message

Ibnu Maksum

unread,
Jul 19, 2011, 3:24:47 AM7/19/11
to phonegap
hi,
i make application to play radio streaming,
in simulator it is work
but in real device not work, but network still doing get data.

can someone give me advice?

in iphone it is work

thank you

Simon MacDonald

unread,
Jul 19, 2011, 2:23:48 PM7/19/11
to phon...@googlegroups.com
What device do you have?
What version of Android does it run?
What version of PhoneGap are you using?
What is the address of the Shoutcast stream?
What do you see when you run "adb logcat" while reproducing the problem?

Details will help us, help you.

Simon Mac Donald
http://hi.im/simonmacdonald

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

Michael Herger

unread,
Jul 19, 2011, 2:56:14 PM7/19/11
to phon...@googlegroups.com
AFAIK this requires Android 2.2 or later to work out of the box.

Michael


--

Michael

Ibnu Maksum

unread,
Jul 19, 2011, 10:54:11 PM7/19/11
to phonegap
> What device do you have?
i use samsung Galaxy Tab

> What version of Android does it run?
android 2.2 Froyo

> What version of PhoneGap are you using?
phonegap.0.9.6.min.js

> What is the address of the Shoutcast stream?
http://live.ardanradio.com:8228/;audio.mp3

> What do you see when you run "adb logcat" while reproducing the problem?
i don't know how to use it :D
works on simulator
but no works in real device

this is my apps
https://market.android.com/details?id=com.ibnux.radio


On 20 Jul, 01:23, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> What device do you have?
> What version of Android does it run?
> What version of PhoneGap are you using?
> What is the address of the Shoutcast stream?
> What do you see when you run "adb logcat" while reproducing the problem?
>
> Details will help us, help you.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald

Simon MacDonald

unread,
Jul 20, 2011, 10:21:36 AM7/20/11
to phon...@googlegroups.com
Hi Ibnu,

I've plugged that shoutcast url into my audio demo and it works on Android 2.2 and 2.3.  If you want to see that demo check out:


To add your shoutcast stream put a new option in with a value of "http://live.ardanradio.com:8228/;audio.mp3".

Here's how to enabled logcat logging:


Simon Mac Donald
http://hi.im/simonmacdonald

Ibnu Maksum

unread,
Jul 21, 2011, 8:58:10 AM7/21/11
to phon...@googlegroups.com
Thank you
I have already read it

PhoneGap media not work in Galaxy Tab
But in another hand set works perfectly

Powered by Telkomsel BlackBerry®


From: Simon MacDonald <simon.m...@gmail.com>
Date: Wed, 20 Jul 2011 10:21:36 -0400
Subject: Re: [PhoneGap] Re: Streaming Shoutcast on android

Simon MacDonald

unread,
Jul 21, 2011, 9:44:36 AM7/21/11
to phon...@googlegroups.com
Then you should run "adb logcat" while reproducing the problem on your Galaxy Tab so we can see what is going on.

Devgeeks

unread,
Aug 3, 2011, 7:13:48 PM8/3/11
to phon...@googlegroups.com
Simon,

I am having a similar issue.

Even with your demo and my URL (http://stream.4zzzfm.org.au:789/) it all works just fine in the emulator but not on my (admittedly cheap) device.

I bought a Huawei Sonic (android 2.3.3) phone for testing on a real device and my app (and your demo) that worked fine in the emulator doesn't get past the 'connecting' stage. It just sits with the position as -0.00000001 or whatever it starts as...

I am sure I could figure it out except for another even more annoying issue... the device seems to have debugging disabled (or at least the log). I enabled USB Debugging, but when I try to run logcat on the device I get:

"Unable to open log device '/dev/log/main': No such file or directory"

Very frustrating.

I don't suppose you might have any suggestions for either issue? heh. I am so unaccustomed to Android. Maybe there is something in the logs when running in the Emulator that I should watch out for, etc?


Devgeeks

unread,
Aug 3, 2011, 7:36:43 PM8/3/11
to phon...@googlegroups.com
UPDATE: 

Ran Simon's demo unadulterated and the internet asset plays fine on my device.

I suspect I was onto something when I asked if something I saw in the logcat when running it on the emulator might be more serious when on the device.

"Server did not give us the content length!"

:/

This is glossed over as a warning and it plays anyway on the emulator, but I suspect the device is not being so friendly?

Simon MacDonald

unread,
Aug 4, 2011, 11:08:20 AM8/4/11
to phon...@googlegroups.com
That seems like a quirk of the Huawei Sonic. Steaming Audio should work on any Android device running OS 2.2 or better. I've tried your stream on my device and it works.

Simon Mac Donald
http://hi.im/simonmacdonald


--

Devgeeks

unread,
Aug 4, 2011, 7:35:15 PM8/4/11
to phon...@googlegroups.com
Simon,

Thanks for the quick reply. 

So my URL in your demo on your device works fine?

Hrm... between this and the logging problem I suspect I need a new test device at the very least.


Devgeeks

unread,
Aug 5, 2011, 9:01:58 AM8/5/11
to phon...@googlegroups.com
UPDATE 2: So I went out and got an HTC Wildfire S tonight on the way home.

First of all, debugging worked straight up just like it was supposed to.

Second, so did the app :) Streamed like a dream.

No idea why the app wasn't working on that phone though. Kind of worries me that I'll release it and some people will download it and it just won't work.

*shrug*

Thanks for all your help...

Simon MacDonald

unread,
Aug 5, 2011, 10:19:12 AM8/5/11
to phon...@googlegroups.com
Welcome to Android development your Fragmentation badge is in the mail ;)

Seriously though, I'm glad your app worked on the new phone. I'm sure
that it'll just work on a wide variety of phones but on some cheaper
devices we'll all have problems so I wouldn't worry too much.

Devgeeks

unread,
Aug 6, 2011, 6:26:28 AM8/6/11
to phon...@googlegroups.com
Fragmentation badge. I like that.

Thanks again for all your help.

MrReview

unread,
Feb 8, 2012, 9:08:32 AM2/8/12
to phon...@googlegroups.com
Hi Devgeeks,

I'm testing your demo with a shoutcast streaming url and it does'nt work :(

I tested with the streaming url somebody said in this google group.

The debug window in Xcode stucks on this line:
2012-02-08 15:02:21.274 altafullaradio[3219:13403] Will use resource 'http://live.ardanradio.com:8228/;audio.mp3' from the Internet.

I'm using the latest version of phonegap, and iOS 5.0.1

With a normal mp3 url it works good. But with a streaming url it does'nt

What I should try?

Thank you.

Kind regards,

Devgeeks

unread,
Feb 8, 2012, 5:49:33 PM2/8/12
to phon...@googlegroups.com
My demo? Or Simon's?


?

Having said that, I plugged your URL into my app and it worked fine. Perhaps a paste bin of your code could help?

MrReview

unread,
Feb 8, 2012, 6:22:24 PM2/8/12
to phon...@googlegroups.com
Hi Devgeeks thanks for your reply...

That's correct it's the Simon's demo...

In android is working fine but in iOS i can't get it to work properly, my code is very simple...

http://pastebin.com/kzyVk7hK

Thank you!

Devgeeks

unread,
Feb 8, 2012, 6:39:28 PM2/8/12
to phon...@googlegroups.com
Oh. Sorry... I missed the Xcode part.

Long story short, there is a known issue that the Media API cannot handle streaming like shoutcast servers on iOS.

For my app I first tried to write my own plugin to do the streaming. I got most of the way there and you are welcome to have a look at it, but in the end I just used HTML5 Audio since it works quite well on iOS.

I used this as a starting point:


It works really well and even gives you background audio complete with the remote button support that was broken in my plugin.

I then went through some HTML5 Audio spec docs that helped me fine tune it using eventListeners for "waiting", "playing", "ended" and "timeupdate" (so I knew when it was buffering, when it was playing, duration, etc). 

I am happy to paste bin share some code if you get stuck, but mine has heaps of jQuery stuff in it specific to my UI.


MrReview

unread,
Feb 8, 2012, 7:00:48 PM2/8/12
to phon...@googlegroups.com
This helped a lot.

I knew about html5 audio tag and tested it successfuly on both android & iOS... but I wanted to test the other way using Media() function from phonegap... now I see that using Audio() insted of Media() is working good on both platforms.

So what do you think is the best mode to work with streaming audio? use Audio() from phonegap or <audio> from html5?

Thank you!

Devgeeks

unread,
Feb 8, 2012, 7:32:40 PM2/8/12
to phon...@googlegroups.com
I actually found html5 audio to be flakey on some Android devices (see: http://www.brianhadaway.com/html5-audio-support-on-android-devices/).

I ended up using PhoneGap's Media API for Android and HTML5 Audio via JavaScript for iOS.

Bruno Sampaio Pinho da Silva

unread,
Aug 20, 2013, 7:46:35 PM8/20/13
to phon...@googlegroups.com
Guys, I came here because I've tried many things, almost every post on this group about streaming but I think the problem is on this shoutcast server... I'm trying to output the stream from this server: http://199.189.107.84:9946/ to my app. But it does not play. When I open it from VLC program http://199.189.107.84:9946/;audio.mp3 I can hear it perfectly... Is it because it does not have a mp3 format from the output? Do you have any idea about what's wrong with this link? I appreciate any comments.

I've been trying this for 2 weeks with no success. I've tried audio and video html5 tags... And your link as well, Devgeeks.
Thanks.

Bruno Sampaio Pinho da Silva

unread,
Aug 20, 2013, 8:00:26 PM8/20/13
to phon...@googlegroups.com
Or maybe the problem is this format: aacp.

Not actually provided by the browsers... Is there a way to solve this?

Kerri Shotts

unread,
Aug 20, 2013, 8:15:51 PM8/20/13
to phon...@googlegroups.com
If I had to guess, you're going to need some native logic to decode the stream. Don't know that there's anything out there already in plugin form, though.


___________________________________
Kerri Shotts
photoKandy Studios, LLC


Social Media:
          Twitter: @photokandy, http://twitter.com/photokandy
          Tumblr: http://photokandy.tumblr.com/
          Github: https://github.com/kerrishotts
                        https://github.com/organizations/photokandyStudios
          CoderWall: https://coderwall.com/kerrishotts

Apps on the Apple Store:

Books:


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages