Flash SWF播放PCM WAV文件? [英] Flash swf to play PCM WAV files?
问题描述
我需要一个能够通过传递给它的URL加载PCM WAV文件的Flash swf.
I am in need of a Flash swf that is capable of loading PCM WAV files via a url passed to it.
可以在此处找到该文件的示例: http://msdn .microsoft.com/en-us/library/ff512405.aspx
An example of the file can be found here: http://msdn.microsoft.com/en-us/library/ff512405.aspx
swf不需要可见的界面,因为它仅用于音频播放,而不用于用户交互.
The swf does not need a visible interface, as it is meant for audio playing only and not user interaction.
swf应该具有用于页面级交互的简单javascript界面.这些包括:
The swf should have a simple javascript interface for page-level interactions. These include:
load(url):使用通过URL的PCM格式在Internet上加载PCM WAV文件. play():应播放已加载的PCM WAV文件 stop():应该停止播放当前文件.
load(url): loads a PCM WAV file over the internet using the url that is passed through it. play(): Should play the PCM WAV file that was loaded stop(): Should stop playing the current file.
如果开发人员无法从上面发布的链接中获取网址,我可以提供与规范相符的音频示例文件.
I can provide a sample audio file that matches the specifications if the developer is unable to obtain a url from the link posted above.
推荐答案
Flash本身不支持PCM编码音频的运行时播放.这意味着您需要解析WAV容器以获取音频并将其输入(Flash 10 +).
Flash does not natively support run-time playback of PCM encoded audio. This means that you'll need to parse the WAV container to get at the audio and feed it in (flash 10+).
http://www .kaourantin.net/2008/05/adobe-is-making-some-noise-part-3.html
更重要的是,您需要跨域权限才能执行此操作,因为您需要以编程方式访问wave数据.
Somewhat more significantly, you'll require crossdomain permission to be able to do so, because you need programmatic access the wave data.
另一种选择是使用我不久前写的一些代码将wave数据烘焙到内存中的swf中,加载它并提取出有效的Sound对象.
Another option is to use some code I wrote a while back to bake the wave data into an in-memory swf, load it and extract a valid Sound object back out.
这篇文章现在已经很老了,应该避免使用无声技术,但是您可以重新设置代码的用途.使用此方法将可用于Flash 9 +.
The article is quite old now, and the the silent-sound technique should be avoided, but you may be able to repurpose the code to do your bidding. Using this method will work with Flash 9+.
这篇关于Flash SWF播放PCM WAV文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!