不支持采样 flex/actionscript
在操作脚本中我需要
Loading configuration file /opt/flex/frameworks/flex-config.xml
t3.mxml(10): Error: unsupported sampling rate (24000Hz)
[Embed(source="music.mp3")]
t3.mxml(10): Error: Unable to transcode music.mp3.
[Embed(source="music.mp3")]
代码是
<?xml version="1.0"?>
<!-- embed/EmbedSound.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.media.*;
[Embed(source="sample.mp3")]
[Bindable]
public var sndCls:Class;
public var snd:Sound = new sndCls() as Sound;
public var sndChannel:SoundChannel;
public function playSound():void {
sndChannel=snd.play();
}
public function stopSound():void {
sndChannel.stop();
}
]]>
</mx:Script>
<mx:HBox>
<mx:Button label="play" click="playSound();"/>
<mx:Button label="stop" click="stopSound();"/>
</mx:HBox>
</mx:Application>
In action script i need
Loading configuration file /opt/flex/frameworks/flex-config.xml
t3.mxml(10): Error: unsupported sampling rate (24000Hz)
[Embed(source="music.mp3")]
t3.mxml(10): Error: Unable to transcode music.mp3.
[Embed(source="music.mp3")]
The code is
<?xml version="1.0"?>
<!-- embed/EmbedSound.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.media.*;
[Embed(source="sample.mp3")]
[Bindable]
public var sndCls:Class;
public var snd:Sound = new sndCls() as Sound;
public var sndChannel:SoundChannel;
public function playSound():void {
sndChannel=snd.play();
}
public function stopSound():void {
sndChannel.stop();
}
]]>
</mx:Script>
<mx:HBox>
<mx:Button label="play" click="playSound();"/>
<mx:Button label="stop" click="stopSound();"/>
</mx:HBox>
</mx:Application>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 livedocs:
Flex Builder 不会为您执行此操作,因此您需要在使用前将“music.mp3”文件手动下采样至 22kHz。
编辑:
我找不到正确的文档,但这里说:
From livedocs:
Flex Builder will not do it for you so you need to downsample the "music.mp3" file to 22kHz manually before using it.
Edit:
I can't find proper documentation but here it says:
您可以删除 ID3v2 标签,它应该可以工作。我认为是APIC。
因此,任何在嵌入 MP3 文件时遇到问题的人,请下载 ID3 Remover: http://sourceforge.net/projects/id3remover/files/id3remover/v1.2/ID3Remover_1_2.zip/download。
You can remove the ID3v2 tag, and it should work. I think it's the APIC.
So anyone who is facing problems embedding MP3 files, download ID3 Remover: http://sourceforge.net/projects/id3remover/files/id3remover/v1.2/ID3Remover_1_2.zip/download .