Commit 9923e821b9ed6d6ff962491805ba929e5e63bfec
1 parent
13fa3e39
fix audio
Showing
2 changed files
with
26 additions
and
15 deletions
src/gxb-ide/Dir.js
| @@ -616,7 +616,7 @@ | @@ -616,7 +616,7 @@ | ||
| 616 | if (role == 0) { | 616 | if (role == 0) { |
| 617 | if (playTimes === 0) { | 617 | if (playTimes === 0) { |
| 618 | // 请求玩立刻执行 | 618 | // 请求玩立刻执行 |
| 619 | - alert('play -----------12 ' + playTimes) | 619 | + alert('play -----------123 ' + playTimes) |
| 620 | $.AudioPlayer.play() | 620 | $.AudioPlayer.play() |
| 621 | } | 621 | } |
| 622 | }else{ | 622 | }else{ |
src/js/audioPlayer/jQuery.AudioPlayer.js
| @@ -241,23 +241,34 @@ | @@ -241,23 +241,34 @@ | ||
| 241 | _this.elements.audioDom.oncanplay = function() { | 241 | _this.elements.audioDom.oncanplay = function() { |
| 242 | _this.log('oncanplay'); | 242 | _this.log('oncanplay'); |
| 243 | // Determine the audio to load / 判断音频加载完毕 | 243 | // Determine the audio to load / 判断音频加载完毕 |
| 244 | - if (_this.elements.audioDom.readyState == 4) { | ||
| 245 | - var duration = Math.round(_this.elements.audioDom.duration); | ||
| 246 | - var minutes = Math.floor(duration / 60); | ||
| 247 | - minutes = 10 <= minutes ? minutes : "0" + minutes; | ||
| 248 | - duration = Math.floor(duration % 60); | 244 | + var duration = Math.round(_this.elements.audioDom.duration); |
| 245 | + var minutes = Math.floor(duration / 60); | ||
| 246 | + minutes = 10 <= minutes ? minutes : "0" + minutes; | ||
| 247 | + duration = Math.floor(duration % 60); | ||
| 249 | 248 | ||
| 250 | - _this.elements.totalTime.html(minutes + ":" + (10 <= duration ? duration : "0" + duration)); | 249 | + _this.elements.totalTime.html(minutes + ":" + (10 <= duration ? duration : "0" + duration)); |
| 251 | 250 | ||
| 252 | - if(typeof _this.options.canplayCallback == 'function'){ | ||
| 253 | - _this.options.canplayCallback({'status': true}); | ||
| 254 | - }else{ | ||
| 255 | - alert('canplayCallback') | ||
| 256 | - _this.options.canplayCallback({'status': true}); | ||
| 257 | - } | ||
| 258 | - }else{ | ||
| 259 | - alert(_this.elements.audioDom.readyState) | 251 | + if(typeof _this.options.canplayCallback == 'function'){ |
| 252 | + _this.options.canplayCallback({'status': true}); | ||
| 260 | } | 253 | } |
| 254 | + | ||
| 255 | + // if (_this.elements.audioDom.readyState == 4) { | ||
| 256 | + // var duration = Math.round(_this.elements.audioDom.duration); | ||
| 257 | + // var minutes = Math.floor(duration / 60); | ||
| 258 | + // minutes = 10 <= minutes ? minutes : "0" + minutes; | ||
| 259 | + // duration = Math.floor(duration % 60); | ||
| 260 | + | ||
| 261 | + // _this.elements.totalTime.html(minutes + ":" + (10 <= duration ? duration : "0" + duration)); | ||
| 262 | + | ||
| 263 | + // if(typeof _this.options.canplayCallback == 'function'){ | ||
| 264 | + // _this.options.canplayCallback({'status': true}); | ||
| 265 | + // }else{ | ||
| 266 | + // alert('canplayCallback') | ||
| 267 | + // _this.options.canplayCallback({'status': true}); | ||
| 268 | + // } | ||
| 269 | + // }else{ | ||
| 270 | + // alert(_this.elements.audioDom.readyState) | ||
| 271 | + // } | ||
| 261 | } | 272 | } |
| 262 | 273 | ||
| 263 | // When the browser is downloading audio / 当浏览器正在下载音频时 | 274 | // When the browser is downloading audio / 当浏览器正在下载音频时 |