使用 Flex 进行移动音频流传输
我是移动应用程序开发的新手,我正在尝试使用 flash builder 4.5 制作一个简单的在线广播应用程序,但每次我尝试从远程站点(流)播放音频时,它都不起作用。我做了不同的测试,当我使用本地音频文件时,一切都完美地工作。下面是我现在正在使用的代码,如果有人能给我一些可能发生的事情的提示,我将非常感激。
**
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://208.76.152.74:8000");
s = new Sound(req,context);
channel=s.play();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button x="200" y="246" label="Play" icon="@Embed('file:///Users/Manu/Downloads/home.png')" click="AudioOn()"/>**
I'm new in the mobile app development and I'm trying to do a simple online radio app using flash builder 4.5, but every time I try to play audio from a remote site (stream) it just not work. I've done different test, and when I use a local audio files everything works flawlessly. Below is the code that I'm using right now, if someone can give me a hint of what could be happening I will really appreciate it.
**
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://208.76.152.74:8000");
s = new Sound(req,context);
channel=s.play();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button x="200" y="246" label="Play" icon="@Embed('file:///Users/Manu/Downloads/home.png')" click="AudioOn()"/>**
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我一直在寻找如何做到这一点,并结合我在使用您的代码时遇到的问题,您只需将 ;Stream.mp3 放在流旁边,就像这样!
req = new URLRequest("http://208.76.152.74:8000;Stream.mp3");
I was looking for how to do this and with combining problems i got i working with your code, you have only to put ;Stream.mp3 next to the stream like this!
req = new URLRequest("http://208.76.152.74:8000;Stream.mp3");
您的应用程序描述符文件中是否启用了互联网权限?
查看此 AIR 文章...
Is the internet permission enabled in your application descriptor file?
See this AIR Article...