播放mp3流在模拟器中运行良好,但不能在设备上播放

时间:2013-06-06 19:15:13

标签: android actionscript-3 flex mobile

我正面临着这个问题。 我正在使用flex&& actionscript在手机上播放mp3流。

代码效果很好,当应用程序在Flash Builder模拟器中运行时播放声音。

然而,当我在移动设备上部署我的应用程序(尝试过多款Android手机)时,一切都很好,除了流不播放!

你能帮帮我吗?

这是我的代码:

<?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.addEventListener(Event.ID3, id3);
            s.addEventListener(Event.OPEN, openHandler);
            s.addEventListener(ProgressEvent.PROGRESS, progressHandler);

在每个处理程序中放置一个断点。:

结果:     EMULATOR:openHandlers.play()达到progressHandler并且{{1}}连续到达{{1}}。

Android设备:永远不会达到处理程序中的断点。没有例外。

0 个答案:

没有答案