Flash swf 播放 PCM WAV 文件吗?
我需要一个能够通过传递给它的 url 加载 PCM WAV 文件的 Flash swf。
可以在此处找到该文件的示例:http://msdn.microsoft。 com/en-us/library/ff512405.aspx
swf 不需要可见的界面,因为它仅用于音频播放而不是用户交互。
swf 应该有一个简单的 javascript 接口用于页面级交互。其中包括:
load(url):使用通过它传递的 url 通过互联网加载 PCM WAV 文件。 play(): 应该播放已加载的 PCM WAV 文件 stop():应该停止播放当前文件。
如果开发人员无法从上面发布的链接获取 URL,我可以提供符合规范的示例音频文件。
I am in need of a Flash swf that is capable of loading PCM WAV files via a url passed to it.
An example of the file can be found here: http://msdn.microsoft.com/en-us/library/ff512405.aspx
The swf does not need a visible interface, as it is meant for audio playing only and not user interaction.
The swf should have a simple javascript interface for page-level interactions. These include:
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flash 本身不支持 PCM 编码音频的运行时播放。这意味着您需要解析 WAV 容器以获取音频并将其输入(flash 10+)。
http://www.kaourantin。 net/2008/05/adobe-is-making-some-noise-part-3.html
更重要的是,您需要跨域权限才能执行此操作,因为您需要以编程方式访问波形数据。
另一种选择是使用我不久前编写的一些代码将波形数据烘焙到内存中的 swf 中,加载它并提取有效的 Sound 对象。
http://flashbrighton.org/?p=9
这篇文章已经很旧了,而且应避免使用无声技术,但您可以重新调整代码的用途来执行您的命令。使用此方法适用于 Flash 9+。
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
Somewhat more significantly, you'll require crossdomain permission to be able to do so, because you need programmatic access the wave data.
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.
http://flashbrighton.org/?p=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+.
http://www.schillmania.com/projects/soundmanager2/
您还可以使用HTML5 音频标签(但这不使用 flash)。请参阅 http://www.whatwg.org/ 了解一些示例。
http://www.schillmania.com/projects/soundmanager2/
You can also use the HTML5 audio tag (however this does not use flash). See http://www.whatwg.org/ for some examples of that.