COM prehensive HTML5音频API [英] Comprehensive html5 Audio API

查看:133
本文介绍了COM prehensive HTML5音频API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我的生活,我不能发现所有的HTML5 &LT的完整列表;音频> 事件和属性(虽然我相信他们会浏览器之间有所不同)。很多我的谷歌搜索有网站谈论使用JavaScript API的音频或使用JavaScript API的声音,等,并给出了几个例子,但我还没有找到一个方法列表或他们做什么。

For the life of me, I cannot find a complete listing of all html5 <audio> events and attributes (though I believe they may vary between browsers). A lot of my googling has websites talking about "using the javascript audio api" or "with the javascript audio api," etc. and shows a couple of examples, but I haven't found a list of methods or what they do.

例如,

var a = document.getElementById('audio');
a.ended = function () { alert('foo!'); }; //FAIL
a.onended = function () { alert('foo!'); }; //FAIL
a.addEventListener('ended', function () { alert('foo!'}); }; //PASS
a.addEventListener('play', function () { alert('foo!'}); };

为什么没有 onended ?为什么叫播放而不是起到?这些东西是不直观,因此API的实际名单将有很大的帮助。

Why is there no onended? Why is it called play instead of played? These things aren't intuitive, so an actual list of the API would help a lot.

此外,做一些浏览器不尊重上面的属性?我的黑莓手机和移动IE9不会对端事件警报,但铬,FFX,和iPad的野生动物园都这样做。

Additionally, do some browsers not respect the above attributes? My blackberry phone and mobile-ie9 won't alert on the ended event, but chrome, ffx, and ipad-safari all do.

推荐答案

  • HTML5 spec: the audio element
  • When can I use... audio compatibility tables (and links to external resources)
  • 不幸的是你亲身经历的事实,目前根本音频没有官方的JavaScript API (还)。

    Unfortunately you're experiencing firsthand the fact that there simply is no official JavaScript API for audio (yet).

    这篇关于COM prehensive HTML5音频API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆