006_Buzz属性和组
生活随笔
收集整理的這篇文章主要介紹了
006_Buzz属性和组
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1. Buzz的默認屬性有以下幾個
?2. preload屬性
2.1. preload屬性是html的audio標簽自帶屬性
<audio preload="load" />2.2. preload屬性規(guī)定是否在頁面加載后載入音頻。如果設置了autoplay屬性, 則忽略該屬性。
2.3. preload屬性值有以下幾個
3. loop屬性
3.1. loop屬性是html的audio標簽自帶屬性
<audio loop="loop" />3.2. loop屬性可以設置為true, 代表循環(huán)播放音樂; 設置為false, 播放一次音樂。
4. formats屬性
4.1. formats屬性設置音頻文件的后綴
buzz.defaults.formats = [ 'ogg', 'mp3', 'aac', 'wav' ];5. 實例化一組音頻
var boom = new buzz.sound("sounds/boom", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true }); var over = new buzz.sound("sounds/over", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true }); var splatter = new buzz.sound("sounds/splatter", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true }); buzz.all().play();6. 組數(shù)組構造函數(shù)
var myGroup = new buzz.group([new buzz.sound("sounds/boom.mp3"), new buzz.sound("sounds/over.mp3"), new buzz.sound("sounds/splatter.mp3")]); myGroup.play();7. 組構造函數(shù)
var myGroup = new buzz.group(new buzz.sound("sounds/boom.mp3"), new buzz.sound("sounds/over.mp3"), new buzz.sound("sounds/splatter.mp3")); myGroup.play();8. 例子
<!DOCTYPE html> <html><head><meta charset="utf-8" /><title>Buzz屬性和組</title><script type="text/javascript" src="buzz.js"></script></head><body><script type="text/javascript">function group (){var boom = new buzz.sound("sounds/boom", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true });var over = new buzz.sound("sounds/over", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true });var splatter = new buzz.sound("sounds/splatter", { formats: [ "ogg", "mp3" ], preload: 'auto', loop: true });buzz.all().play();}function groupArrayConstructor (){var myGroup = new buzz.group([new buzz.sound("sounds/boom.mp3"), new buzz.sound("sounds/over.mp3"), new buzz.sound("sounds/splatter.mp3")]);myGroup.play();}function groupConstructor (){var myGroup = new buzz.group(new buzz.sound("sounds/boom.mp3"), new buzz.sound("sounds/over.mp3"), new buzz.sound("sounds/splatter.mp3"));myGroup.play();}</script><button onclick="group()">實例化一組音頻</button><button onclick="groupArrayConstructor()">組數(shù)組構造函數(shù)</button><button onclick="groupConstructor()">組構造函數(shù)</button></body> </html>總結
以上是生活随笔為你收集整理的006_Buzz属性和组的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 001_推箱子-绘制图片
- 下一篇: 071_html语言代码