- 浏览: 297680 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
开发小菜:
支持IE9以下的吗?
HTML5+CSS3+JQuery打造自定义视频播放器 -
攻城使:
开发Html5必须得下载么,我用dw编写,把文件复制到myec ...
html5开发 myeclipse安装aptana插件 -
疾风鹰狼:
...
根据判断浏览器类型屏幕分辨率自动调用不同CSS的代码 -
sardodo:
你好,我想问下,导入例子中的.dae格式模型是可以看到旋转的小 ...
c3dl 初步认识 -
BIOHAZARDX:
下载学习,初学者膜拜一下。
html5 实现动画(三)
One of the neatest things about HTML5 is support for the new <audio> tag. Like <video> it allows you to natively support media in good browsers like Chrome, FireFox, Opera and Safari. Add a touch of JavaScript and a new era of media applications become possible. Synthesizers, music trackers and games require seamless audio loops though so we need something a bit simpler for our first foray into HTML5 audio. Oooh, how about a retro beatbox with individual track adjustments (start/stop/loop/volume) that could be used to build a unique soundscape from many separate instruments. Perfect! Fantasy can only become reality through hard work so let’s get started with some tests first. Uses the ‘loop’ property. Uses a JavaScript function to loop when an ‘ended’ event is called. Uses two JavaScript functions and two audio elements with the same source to alternate playback duties. Tests were done on Windows 7 with Chrome 5.0.342.9 beta, FireFox 3.6.3, Internet Explorer 9.0 Preview, Opera 10.51 and Safari 4.0.5. Chrome seems to trigger loops before the current sound is completely finished leading to some odd jumpiness. All loop methods are affected. FireFox doesn’t seem to like the ‘loop’ property of method 1, odd. Method 2 has the slightest of delays between loops and method 3 was actually perfect! I didn’t believe it until verification at the millisecond level with Audacity. Hooray Mozilla! Internet Explorer 9 doesn’t support the audio tag yet. Hopefully it will before an official release. Opera performs almost as well as FireFox although there is still a small delay even when using method 3. Safari seems slow to start playback which is very easy to detect once you hear a loop. All loop methods affected. Feedback on other browsers/OS compatibility would be very interesting so please feel free to discuss any findings in the comments below. As of right now (April 11, 2010) only FireFox can do a perfect loop by cheating a bit and using two <audio> elements with JavaScript. So yeah, it’s a bit too early for HTML5 audio loops but don’t let that stop you from creating sound boards, media players and other fun things. Hopefully with some more optimizations audio support will continue to improve and a HTML5 beatbox fantasy can become reality. Until then there are plenty of other fun things to play with. Cheers!Loop Method 1
<audio id="audio_1" controls preload loop>
<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio>
Loop Method 2
<audio id="audio_2" controls preload>
<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio>
document.getElementById('audio_2').addEventListener('ended', function(){
this.currentTime = 0;
}, false);
Loop Method 3
<audio id="audio_3" controls preload>
<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio>
<audio id="audio_4" controls preload>
<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio>
document.getElementById('audio_3').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_4').play();
}, false);
document.getElementById('audio_4').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_3').play();
}, false);
Browser Support
Final Thoughts
发表评论
-
iframe 高度自适应
2011-11-03 17:07 1318转自:http://apps.hi.baidu.com/sha ... -
WordPress 博客添加新浪微博挂件:
2011-06-22 14:07 14371.点击链接http://t.sina ... -
HTML5 影音 ( Video ) 概論
2011-05-25 16:25 10031 Video介紹 引用我翻譯文檔《在HTML5頁面 ... -
处理火狐自动播放视频
2011-05-18 17:54 1393版权声明:转载时请 ... -
教你用HTML5开发iPhone应用程序
2011-05-13 17:38 1133你一整年都像现在一样沮丧,这我知道。所有铁杆Objecti ... -
很给力,20个HTML5视频播放器及代码
2011-05-09 14:45 1922本文来源: http://www.uleadesi ... -
HTML 5 Video概述
2011-05-09 13:32 907本文来自:http://www.xlnv.ne ... -
支持移动平台的Html5播放器
2011-05-09 13:25 2851本文转自:http://www.riameeting ... -
HTML5 API简介一(Canvas,Audio/Video,Geolocation)
2011-05-09 13:22 1506本文来自:http://www.myext.cn/web ... -
HTML5资源
2011-05-09 11:56 1149JS APIs: 选择器 W3C草案:Selecto ... -
HTML5 Audio/Video 标签,属性,方法,事件
2011-05-09 11:53 1375本文转自:http://directguo.com/blo ... -
DIV实现隐藏与显示
2011-05-06 15:23 702css中display属性的参考值: display:n ... -
HTML5+CSS3+JQuery打造自定义视频播放器
2011-05-06 12:57 6677简介HTML5的<video> ... -
HTML 5 <video> preload 属性
2011-05-06 12:54 1078设置为预加载的 video 元素: <vide ... -
HTML5 – Video
2011-05-06 12:51 998在HTML5以前若我們要在網頁中播放影片時,需要使用Act ... -
超過 23 個開源的 HTML5 影音播放器與框架
2011-05-06 12:03 7477超過 23 個開源的 HTML5 影音播放器與框架 - ... -
Building a better HTML5 video player with Glow
2011-05-06 11:51 1030Last year I wrote a post (Bu ... -
Ambilight для тэга video
2011-05-06 11:49 738В некоторых топовых моделях т ... -
怎样用js+html5实现视频的播放控制
2011-05-06 11:46 1358html5 代码: <video width ... -
22个HTML5的初级技巧
2011-05-06 11:45 664Web技术的发展速度太快了,如果你不与时俱进,就会被淘汰。 ...
相关推荐
[Apple官方] Apple Loops Audio
Dealing with Audio Ground Loops
Christophe Basso先生的《Designing Control Loops For Linear and Switching Power Supplies》 关电源 环路控制 零点 极点 在开关模式的功率转换器中,功率开关的导通时间是根据输入和输出电压来调节的。因而,功率...
Readers also find coverage of the underpinnings and principles of control loops so they can gain a more complete understanding of the material. This authoritative volume explains how to conduct ...
Loops,Kknots, Gauge Theories and Quantum Gravity Loops,Kknots, Gauge Theories and Quantum Gravity Loops,Kknots, Gauge Theories and Quantum Gravity
Phase Lock Loops and Frequency Synthesis 锁象环与频率合成经典教材
For Loops.ipynb
CD-Rom for the book "Phase-Locked Loops Design,Simulation and Applications by R.E.Best. A design program for Phase-locked loops circuits
介绍RF仿真,可以用于微博专业同学学习之用。。。
ios runloops 四个测试用例
模拟集成电路的分析与设计:Chapter 15-Phase-Locked Loops.ppt
Razavi_Monolithic_Phase-Locked_Loops_and_Clock_Recovery_Circuits 第三部分
锁相环经典书籍,对于想了解无线电,激光器锁相或许有帮助。
锁相环好书许多电子设备要正常工作,通常需要外部的输入信号与内部的振荡信号同步,利用锁相环路就可以实现这个目的。 锁相环路是一种反馈控制电路,简称锁相环(PLL)。
Author:Saleh R. Al-Araji, Zahir M. Hussain, Mahmoud A. Al-Qutayri Publisher: Springer Number Of Pages: 191 Publication Date: 2006-10-19 ISBN / ASIN: 0387328637 数字锁相环:结构与应用
Razavi_Monolithic_Phase-Locked_Loops_and_Clock_Recovery_Circuits 第二部分
nice fx fruity loops music house music eric pridz
iOS Runloop官方文档翻译.Run loops 是线程相关的的基础框架的一部分。一个 run loop 就是一个事件处理 的循环,用来不停的调度工作以及处理输入事件。使用 run loop 的目的是让你的线 程在有工作的时候忙于工作,...
JavaScript-Loops-源码.rar
Loops