0 Replies Latest reply on Jun 6, 2013 12:17 PM by DanDinu

    playing mp3 stream works well in Emulator but doesn't play on Device

    DanDinu

      I'm facing this problem. I'm using flex && actionscript to play an mp3 stream on the phone.

       

       

      Code works great and the sound is played when the app is run in the flash builder emulator.

       

       

      However, when i deploy my app on a mobile device (tried several Android phones) everything is good except the stream doesn't play!

       

       

      Can you please help me??

       

       

      Here's my code:

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                          xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"

                          creationComplete="view1_creationCompleteHandler(event)"

                          >

                <fx:Script>

                          <![CDATA[

                                    import mx.events.FlexEvent;

       

       

                                    import flash.net.*;

                                    import flash.media.*;

                                    private  var req:URLRequest;

                                    private  var context:SoundLoaderContext = new SoundLoaderContext(8000, true);

                                    private   var s:Sound;

                                    private  var channel:SoundChannel = new SoundChannel();

       

                                    private  function AudioOn():void

                                    {

                                              req = new URLRequest("http://stream2.srr.ro:8000/;stream.mp3");

                                              s = new Sound(req,context);

                                              channel=s.play();

                                    }

       

                                    protected function view1_creationCompleteHandler(event:FlexEvent):void

                                    {

                                              AudioOn();

       

                                    }

       

                          ]]>

                </fx:Script>

                <fx:Declarations>

                          <!-- Place non-visual elements (e.g., services, value objects) here -->

                </fx:Declarations>

      </s:View>