Copy link to clipboard
Copied
Hi,
I spent my precious 2 days time to write an application (AIR-Android) which can play internet radio stations (streamed audio). Every thing worked great when I used 'Test Movie' or Ctrl+ENTER. But same is not working when I generated the .apk and installed on HTC Desire HD (running Android 2.2 and have AIR with latest updates).
I have predefined few internet radio stations and clicking on the station name should start playing the radio. I have used the SoundChannel with 3 second buffering option. On the device application triggers the buffering event but never comes out of that or plays the audio.
I have tried few things:
1. Prepared a test file with only one station
2. In publish settings --> Audio Stream set the bit rate to 24kbps which is same as that station is streamed
3. Increased the script limit to 30 seconds
4. Tried to use Security.allowDomain() which caused runtime error (3207 Application-sandbox content cannot access this feature)
I used the station "http://stream.radiosai.net:8004" for testing. The station is active, streaming in MP3 format and able to listen through the Windows Media Player / VLC.
I prepared a self signed AIR for desktop as well and installed on my laptop (Windows 7 64-bit) but same problem.
I have prepared this using Air for Android extn for Flash CS5.
Please let me know if anybody has faced the same problem, suggest me if I am really missing anything.
Here the AS3 code used for testing.
===========================
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
const AFRICA_STREAM:String = "http://stream.radiosai.net:8004";
var isPlaying:Boolean = false;
var recentlyPlayed:String = "";
var streamSound:Sound;
var streamChannel:SoundChannel;
var streamContext:SoundLoaderContext = new SoundLoaderContext(3000,false);
var streamTimer:Timer;
africa_mc.addEventListener(MouseEvent.CLICK, handleStationSelect);
function handleStationSelect(evt:MouseEvent):void {
if (isPlaying == true) {
streamChannel.stop();
streamSound = null;
streamChannel = null;
isPlaying = false;
streamTimer.stop();
removeListeners();
}
switch (evt.target.name) {
case "africa_mc" :
if (recentlyPlayed != "africa_mc") {
playStation(AFRICA_STREAM);
recentlyPlayed = "africa_mc";
}
break;
}
}
function playStation(streamUrl:String):void {
streamSound = new Sound();
addListeners();
streamSound.load(new URLRequest(streamUrl), streamContext);
streamChannel = streamSound.play();
isPlaying = true;
streamTimer = new Timer(2000);
streamTimer.addEventListener(TimerEvent.TIMER, checkPlayState);
streamTimer.start();
}
function soundIoError(evt:IOErrorEvent):void {
streamChannel.stop();
streamSound.close();
streamSound = null;
streamChannel = null;
removeListeners();
play_state.text = "IO Error";
}
function checkPlayState(evt:TimerEvent):void {
if (streamSound.isBuffering == true) {
play_state.text = "Buffering...";
}
else {
play_state.text = "Playing...";
}
}
function addListeners() {
streamSound.addEventListener(IOErrorEvent.IO_ERROR, soundIoError);
}
function removeListeners() {
streamSound.removeEventListener(IOErrorEvent.IO_ERROR, soundIoError);
streamTimer.removeEventListener(TimerEvent.TIMER, checkPlayState);
}
=========================================================
Its very sad that adobe has created something fully buggy and works only on IDE but not on actual device. More sad part is adobe is not even cared to have a look into the issue.
Copy link to clipboard
Copied
Just to make sure I tried to trace the output of 'soundObj.isURLInaccessible' and 'soundObj.Url' when checking for 'isBuffering' and got the result as 'false' and 'http://stream.radiosa.net:8004/" which is same as the one used to load. With that its pretty clear that some issue in the Air-Android runtime itself.
Is anybody faced similar problem?
Regards,
MSH
Copy link to clipboard
Copied
Hi MSH,
I'm sorry you're running into problems getting this to work on your device. Thanks for the detailed report, including the source code. I just tried this out using Flash Builder 4.5 (Burrito). I had to change the stream URL, as the one you posted appeared to be offline. Using the default permissions, I found that while the stream played fine on the desktop, it failed to play on my device. However, if I enabled "android.permission.INTERNET" in my application descriptor, audio played fine on my device (T-Moble G2.)
<android> <manifestAdditions><![CDATA[ <manifest android:installLocation="auto"> <uses-permission android:name="android.permission.INTERNET"/> </manifest> ]]></manifestAdditions> </android> </application>
Can you verify that this permission is set?
Thanks,
Chris
Copy link to clipboard
Copied
Hi Chris,
I am using Air for Android in flash CS5. In the app_name-app.xml android.permissions.INTERNET is enabled.
<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
]]>
I tried several stations but had no luck in playing them on device
Is there any difference in using 'Burrito' and 'Air for Android' extn in flash CS5 for building the apps (I mean w.r.t to .apk generated)?
As far as I think IDE shouldn't matter since the runtime player remains the same...
Could you please share the station URL you have used ?
Copy link to clipboard
Copied
Are you using the labs release of the AIR publishing component of Flash CS5? I used Flash Builder 5.5 in my test. For the stream URL I used http://208.80.52.246/ESPNRADIOCMP3
I've asked the team responsible for Android development to take a look at this thread so hopefully we'll get more feedback soon.
Thanks,
Chris
Copy link to clipboard
Copied
Yes.. I am using the lab release of Air for Android extn which I downloaded long back... I will try with the link you have used and will update soon...
I have Flash Builder 4 license as well... wondering if the same license key works for FB 4.5?
Thanks and Regards,
MSH
Copy link to clipboard
Copied
I Have the same problem no audio stream over device Galaxy s I9000, AIR Runtime 2.6 Flash Player 10.2
I Compiled with AIR for Android in Flash CS5, in IDE Stream Work Good!!! Compiled .apk not work on Device!
Permission INTERNET is Set!
Any Idea?
Thank's
Copy link to clipboard
Copied
MSH,
I am not familiar with your stream URL.
I tried with
http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3
and there is no problem with playing on Android.
You said you get it work with "Test"? If you do, could you mail that file to me and I could check it out.
-ted
Copy link to clipboard
Copied
Hi Chris / tzeng,
Let me put it in much cleaner way :
What I am trying to achieve?
- Listen / play internet radio (IR) stations.
- Links are taken from : http://wiki.secondlife.com/wiki/Music_streams & few from Shoutcast
What are all the available formats for IR station URL?
1. http://server_name:NNNN/ where NNNN is port number
- http://stream.radiosai.net:8004
- http://wjab.streamguys.net:80/
- http://radio2.trancemission.fm:80/
2. http://server_ip_address:NNNN
- http://65.60.19.44:80/
- http://213.246.51.97:8024/
3. http://server_name_OR_ip/stream/xyz
- http://scfire-ntc-aa03.stream.aol.com:80/stream/1025
- http://208.80.52.246/ESPNRADIOCMP3
4. http://server_name_OR_ip:NNNN/xyz.mp3
- http://stream.transmissionfm.com:8000/techno-high.mp3
- http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3
Please share if anybody came across different format than these.....
What is working on device and what is not working?
Any URL of format 3 & 4 is working on the device.
Any URL of format 1 & 2 is not working on the device.
What happens if the swf is opened in flash player like debugger version (flashplayer_10_sa_debug)?
Tried with 4 URL each of different format. Debugger player is able to play all the stations.
What happens if the swf is opened in IE browser with Flash plugin?
Only URL of format 3 & 4 works.
What happens if 'Test Movie' is used in IDE?
Only URL of format 3 & 4 works.
Now question is why URL with format 1 & 2 fails? Why same links work on debugger version or VLC or windows media player?
I have captured the packets sent(received) from(at) device (HTC Desire HD) using WireShark (on Windows 7). I dont see any option to attach the files. Will try to send as private message.
After a deep search I found that this issue is already faced : http://forums.adobe.com/message/3027799
Thanks and Regards,
MSH
Copy link to clipboard
Copied
MSH,
Let me ask this question ( I am in a rush today. Could not read through your message carefully.)
Is there any situation where the app. works on desktop, but fails to work on Android devices?
Thanks,
-ted
Copy link to clipboard
Copied
I will try that and update you soon.....
Copy link to clipboard
Copied
ok... quickly prepared desktop installers (AIR 2.5) with self signed certificate... Only URL of format 3 & 4 works... but had no luck with URL of format 1 & 2
As I mentioned earlier if I use the flash player debugger version then I am able to listen through the URLs of all formats.
http://www.adobe.com/support/flashplayer/downloads.html
OS : Windows 7 Professional (64 - bit)
Copy link to clipboard
Copied
Could you send me the project file?
My email address is zeng@adobe.com
Thanks,
-ted
Copy link to clipboard
Copied
Did u receive my mail?
Copy link to clipboard
Copied
Hi,
Here is an update :
I wrote a piece of code in AS2 and published for FlashLite 2.1 on Flash CS5. When I hit 'Ctrl + Enter' (or Test Movie) to my surprise the links worked.
This is what I tried :
var testSound:Sound = new Sound();
testSound.loadSound("http://stream.radiosai.net:8004/", true);
testSound.start();
So the reason why same doesn't work in AS3 may be because of "URLRequest" which might interpret the URL of type 1 & 2 as a request to webpage.... not sure... please correct me if I am wrong....
Regards,
MSH
Copy link to clipboard
Copied
You probably sent the mail to Chris. Chris forwarded the file to me.
We will take a look at this and get back to you. -ted
Copy link to clipboard
Copied
Hi MSH,
Thank you for the sample code and your investigation! Would you mind adding a new bug for this at http://bugbase.adobe.com? Please include the latest details, instructions and attach your sample code/project. It would be great if you could then post a link to the bug here so others effected can add their votes and comments. I'll make sure to note your bug number in our "hot topics" page which is already tracking this issue.
Thanks,
Chris
Copy link to clipboard
Copied
Hi Chris,
Thanks for your time. I have added the bug and reference number is 'Bug 2869263'.
Thanks and Regards,
MSH
Copy link to clipboard
Copied
Hi Chris,
Is this bug removed from Bugbase? I am getting "The information requested is not found" message when I tried to open the page with bug id 2869263...
https://bugbase.adobe.com/index.cfm?event=bug&id=2869263
Even my bugbase account home page shows that total number of bugs logged 0 (zero) ...... ???????
Copy link to clipboard
Copied
Hi MSH,
I'm looking into it. The bug is still viewable internally (currently set to open/to test) but I'm seeing the same message when viewing it externally. I'll let you know what I find out.
Chris
Copy link to clipboard
Copied
Has this bug been found yet? Because I am having the same problem with a player I wrote to stream a radio station, and the issue of setting the INTERNET permission is set (double checked).
Copy link to clipboard
Copied
This bug was deferred for the upcoming AIR release. I'd highly recommend visiting the bug (using the URL above) and adding your vote and comments.
Thanks,
Chris
Copy link to clipboard
Copied
Thanks, i'll do that. In the mean time I think I have an idea of a work around if any one is interested.
embed a html 5 page in your flex app with an audio tag that plays the stream, use javascript functions to control the audio, and call the javascript functions from flex using the external command.
This is only theory at the moment, haven't had time to test it.
Thanks again, good night.
Copy link to clipboard
Copied
Changing the subject to match the issue description