Commit c6b9deafeea419af9682513f9bbc0ccdb4cb0a2a
1 parent
13489a3f
test
Showing
1 changed file
with
7 additions
and
0 deletions
src/js/audioPlayer/jQuery.AudioPlayer.js
| @@ -239,6 +239,7 @@ | @@ -239,6 +239,7 @@ | ||
| 239 | 239 | ||
| 240 | // When the browser can play audio / 当浏览器可以播放音频时 | 240 | // When the browser can play audio / 当浏览器可以播放音频时 |
| 241 | _this.elements.audioDom.oncanplay = function() { | 241 | _this.elements.audioDom.oncanplay = function() { |
| 242 | + alert('oncanplay') | ||
| 242 | _this.log('oncanplay'); | 243 | _this.log('oncanplay'); |
| 243 | // Determine the audio to load / 判断音频加载完毕 | 244 | // Determine the audio to load / 判断音频加载完毕 |
| 244 | var duration = Math.round(_this.elements.audioDom.duration); | 245 | var duration = Math.round(_this.elements.audioDom.duration); |
| @@ -273,6 +274,7 @@ | @@ -273,6 +274,7 @@ | ||
| 273 | 274 | ||
| 274 | // When the browser is downloading audio / 当浏览器正在下载音频时 | 275 | // When the browser is downloading audio / 当浏览器正在下载音频时 |
| 275 | _this.elements.audioDom.onprogress = function() { | 276 | _this.elements.audioDom.onprogress = function() { |
| 277 | + alert('onprogress') | ||
| 276 | if (_this.elements.audioDom.readyState == 4) { | 278 | if (_this.elements.audioDom.readyState == 4) { |
| 277 | _this.elements.loadProgress.width((_this.elements.audioDom.buffered.end(0) / _this.elements.audioDom.seekable.end(0)) * _this.elements.totalPlayProgress.width()); | 279 | _this.elements.loadProgress.width((_this.elements.audioDom.buffered.end(0) / _this.elements.audioDom.seekable.end(0)) * _this.elements.totalPlayProgress.width()); |
| 278 | } | 280 | } |
| @@ -280,6 +282,7 @@ | @@ -280,6 +282,7 @@ | ||
| 280 | 282 | ||
| 281 | // When the browser begins searching for the audio / 当浏览器开始查找音频时 | 283 | // When the browser begins searching for the audio / 当浏览器开始查找音频时 |
| 282 | _this.elements.audioDom.onloadstart = function() { | 284 | _this.elements.audioDom.onloadstart = function() { |
| 285 | + alert('onloadstart') | ||
| 283 | _this.log('onloadstart'); | 286 | _this.log('onloadstart'); |
| 284 | if(typeof _this.options.onloadstartCallback == 'function'){ | 287 | if(typeof _this.options.onloadstartCallback == 'function'){ |
| 285 | _this.options.onloadstartCallback({'status': true}); | 288 | _this.options.onloadstartCallback({'status': true}); |
| @@ -288,18 +291,21 @@ | @@ -288,18 +291,21 @@ | ||
| 288 | 291 | ||
| 289 | // When the audio has begun or is no longer suspended / 当音频已开始或不再暂停时 | 292 | // When the audio has begun or is no longer suspended / 当音频已开始或不再暂停时 |
| 290 | _this.elements.audioDom.onplay = function() { | 293 | _this.elements.audioDom.onplay = function() { |
| 294 | + alert('onplay') | ||
| 291 | _this.log('onplay'); | 295 | _this.log('onplay'); |
| 292 | _this.elements.playButton.find('img').attr('src', _this.options.imagePath + '/pause.png'); | 296 | _this.elements.playButton.find('img').attr('src', _this.options.imagePath + '/pause.png'); |
| 293 | } | 297 | } |
| 294 | 298 | ||
| 295 | // When the audio has been suspended / 当音频已暂停时 | 299 | // When the audio has been suspended / 当音频已暂停时 |
| 296 | _this.elements.audioDom.onpause = function() { | 300 | _this.elements.audioDom.onpause = function() { |
| 301 | + alert('onpause') | ||
| 297 | _this.log('onpause'); | 302 | _this.log('onpause'); |
| 298 | _this.elements.playButton.find('img').attr('src', _this.options.imagePath + '/play.png'); | 303 | _this.elements.playButton.find('img').attr('src', _this.options.imagePath + '/play.png'); |
| 299 | } | 304 | } |
| 300 | 305 | ||
| 301 | // When the current playlist has ended / 当目前的播放列表已结束时 | 306 | // When the current playlist has ended / 当目前的播放列表已结束时 |
| 302 | _this.elements.audioDom.onended = function() { | 307 | _this.elements.audioDom.onended = function() { |
| 308 | + alert('onended') | ||
| 303 | _this.log('onended'); | 309 | _this.log('onended'); |
| 304 | 310 | ||
| 305 | if(typeof _this.options.endedCallback == 'function'){ | 311 | if(typeof _this.options.endedCallback == 'function'){ |
| @@ -327,6 +333,7 @@ | @@ -327,6 +333,7 @@ | ||
| 327 | } | 333 | } |
| 328 | 334 | ||
| 329 | _this.elements.audioDom.onwaiting = function() { | 335 | _this.elements.audioDom.onwaiting = function() { |
| 336 | + alert('onwaiting') | ||
| 330 | _this.log('onwaiting'); | 337 | _this.log('onwaiting'); |
| 331 | if(typeof _this.options.onwaitingCallback == 'function'){ | 338 | if(typeof _this.options.onwaitingCallback == 'function'){ |
| 332 | _this.options.onwaitingCallback({'status': true}); | 339 | _this.options.onwaitingCallback({'status': true}); |