0 Replies Latest reply on Oct 5, 2012 1:39 AM by kreativs_lv

    Audio problem

    kreativs_lv

      Hello!

       

      My problem is that sound is making echo on presing play button twice is there solution to make auto play vhen tab is selected or aplication starti it start streaming audi and with the stop button you can stop it!

       

      My code is there...

       

      <?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"

                          actionBarVisible="true" overlayControls="false" tabBarVisible="true" title="Radio Valmiera">

       

      <fx:Declarations>

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

      </fx:Declarations>

       

      <fx:Script>

                          <![CDATA[

                                    private var req:URLRequest;

                                    private var context:SoundLoaderContext = new SoundLoaderContext(1000);

                                    private var s:Sound;

                                    private var channel:SoundChannel = new SoundChannel();

       

                                    private function playAudio():void

                                    {

                                              req = new URLRequest("http://85.254.49.110:8002/radiov");

                                              s = new Sound(req, context);

                                              channel = s.play();

                                    }

       

                                    private function stopAudio():void

                                    {

                                              channel.stop();

                                    }

       

                                    protected function startBtn_activateHandler(event:Event):void

                                    {

        // TODO Auto-generated method stub

       

                                    }

       

                          ]]>

      </fx:Script>

                <s:Image width="100%" horizontalCenter="0"

                                     source="@Embed('file:///Users/ARStudija/Desktop/BG/bgradio_low.png')"

                                     verticalCenter="0"/>

                <s:Image top="30" width="50%" height="25%" horizontalCenter="-1" scaleMode="letterbox"

                                     smooth="true" smoothingQuality="default"

                                     source="@Embed('file:///Users/ARStudija/Desktop/-1.png')"/>

                <s:Image id="startBtn" width="100%" activate="startBtn_activateHandler(event)"

                                     click="playAudio(); stopBtn.visible=true; startBtn.visible=false" horizontalCenter="0"

                                     smooth="true" smoothingQuality="default"

                                     source="@Embed('file:///Users/ARStudija/Desktop/BG/play.png')" verticalCenter="0"/>

                <s:Image id="stopBtn" width="100%"

                                     click="stopAudio(); startBtn.visible=true; stopBtn.visible=false" horizontalCenter="0"

                                     scaleMode="letterbox" smooth="true"

                                     source="@Embed('file:///Users/ARStudija/Desktop/BG/sto.png')" verticalCenter="0"/>

       

       

       

       

      </s:View>