有没有可靠的方法来对浏览器中播放的音频文件进行 JavaScript 动画计时?
例如,我希望页面播放音频文件,同时让一些项目符号在音频文件中讨论所述项目符号的正确时刻滑入视图。类似的效果也可用于隐藏式字幕。当我说可靠时,我特指的是,时间在许多常见平台(浏览器/操作系统/CPU/等)上是一致的,并且在同一平台上的不同会话中也是一致的(它们点击刷新,它会像以前一样再次工作) , ETC)。
注意:如果答案是“否”也没关系,但请至少包含一些关于原因的俏皮话。
For example, I want the page to play an audio file while at the same time have some bullets slide into view at just the right moment that said bullet is talked about in the audio file. A similar effect would also be used for closed captioning. When I say reliable I mean specifically that the timing will be consistent across many common platforms (browser/OS/CPU/etc) as well as consistent in different sessions on the same platform (they hit refresh, it works again just as it did before, etc).
NOTE: It's OK if the answer is 'NO', but please include at least a little quip about why that is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看此动画,它将 3D SVG 效果同步到音频文件。
该技术在 http://mrdoob.com/blog/page/3。查找标题为“svg 标签+音频标签= 3D 波形”的内容。关键是创建一个与音频文件对应的音量值表。
显然,您需要做一些工作来研究这个示例及其使用的 Javascript,以使其适应您的场景。它可能只能在支持 HTML5 的浏览器中运行。
Check out this animation, which synchronizes a 3D SVG effect to an audio file.
The technique is explained in a blog post at http://mrdoob.com/blog/page/3. Look for the one entitled "svg tag+audio tag = 3D waveform". The key is to create a table of volume values corresponding to the audio file.
You'll obviously have some work to do in studying this example and the Javascript it uses to adapt it to your scenario. And it will probably only work in browsers that support HTML5.
考虑到目前的情况和 HTML5 支持,我会使用 Flash 来解决这个问题。
Given the current situation and HTML5 support, I would solve this using Flash.