设为首页 加入收藏

TOP

用JavaScript操纵HTML5的本地音频
2014-11-24 12:25:50 来源: 作者: 【 】 浏览:0
Tags:JavaScript 操纵 HTML5 本地 音频

HTML5的音频元素是一个非常强大的元素并且可以避免过多依赖第三方插件。例如QuickTime,Flash。最新的浏览器,比如Chrome10+和Firefox3.6+都已经嵌入了java script库,并且还提供了方法和属性来操纵


摘要:尽管这篇文章主要介绍Audio对象,但是这些方法和属性也同样适用于Video对象。


Audio Methods


.load();


---Loads and re-loads the audio element for playback。(加载或者重加载audio元素实现重播)


.play();


---Starts playing the audio file。(开始播放音频文件)


.pause();


Pauses playback of the audio file。(暂停播放音频文件)


canPlayType(type);


---Checks with browser to see if type of audio file is supported。(检查浏览器是否支持音频文件)


Audio Properties


.currentTime


---Sets or returns the playback position in the audio file, Value is in seconds。(设置或返回音频文件开始播放的位置,返回值以“秒”为单位)



.duration


---Returns the length of the audio file in seconds。(返回播放音频在某秒上的播放的长度)



.src


---The url where the audio file exists。(音频文件的url)



.volume


---Sets or returns the volume of the audio file。(设置或返回音频文件的体积)



注意:以上并没有把音频的所有方法和属性列出来,只介绍了常用的几个方法和属性。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Linux工作队列workqueue实现分析 下一篇Visual Studio 11:使用 C++ 开发..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·数据库:推荐几款 Re (2025-12-25 12:17:11)
·如何最简单、通俗地 (2025-12-25 12:17:09)
·什么是Redis?为什么 (2025-12-25 12:17:06)
·对于一个想入坑Linux (2025-12-25 11:49:07)
·Linux 怎么读? (2025-12-25 11:49:04)