Commit 2c32cfe90c1202ffe4679f64ca17e2549b802652
1 parent
2084f7b2
fix audio
Showing
7 changed files
with
46 additions
and
22 deletions
dist/css/mobile.css
dist/gxb-ide/Dir.js
| ... | ... | @@ -616,8 +616,8 @@ |
| 616 | 616 | if (role == 0) { |
| 617 | 617 | if (playTimes === 0) { |
| 618 | 618 | // 请求玩立刻执行 |
| 619 | + // alert('play -----------123 ' + playTimes) | |
| 619 | 620 | $.AudioPlayer.play() |
| 620 | - playTimes++ | |
| 621 | 621 | } |
| 622 | 622 | }else{ |
| 623 | 623 | CodingEditer.playCoding(); |
| ... | ... | @@ -653,22 +653,30 @@ |
| 653 | 653 | debuggers: false, |
| 654 | 654 | allowSeek: false, |
| 655 | 655 | canplayCallback: function(res){ |
| 656 | + // alert('res.status ----------- ' + res.status) | |
| 656 | 657 | if (res.status == true) { |
| 658 | + // alert('canplayCallback ----------- ' + playTimes) | |
| 657 | 659 | CodingEditer.playCoding(); |
| 658 | 660 | } |
| 659 | 661 | }, |
| 660 | 662 | onwaitingCallback: function(){ |
| 661 | 663 | if (playTimes != 0) { |
| 664 | + // alert('onwaitingCallback ----------- ' + playTimes) | |
| 662 | 665 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 663 | 666 | CodingEditer.pauseCode(); |
| 667 | + }else{ | |
| 668 | + playTimes++ | |
| 664 | 669 | } |
| 665 | 670 | }, |
| 666 | 671 | playCallback: function() { // 播放 |
| 672 | + // alert('播放 ----------- ' + playTimes) | |
| 667 | 673 | if (playTimes != 0) { |
| 674 | + // alert('playCallback ----------- ' + playTimes) | |
| 668 | 675 | CodingEditer.playCoding(); |
| 669 | 676 | } |
| 670 | 677 | }, |
| 671 | 678 | pauseCallback: function() { // 暂停 |
| 679 | + // alert('playCallback ----------- ' + playTimes) | |
| 672 | 680 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 673 | 681 | CodingEditer.pauseCode(); |
| 674 | 682 | }, | ... | ... |
dist/js/audioPlayer/jQuery.AudioPlayer.js
| ... | ... | @@ -241,18 +241,34 @@ |
| 241 | 241 | _this.elements.audioDom.oncanplay = function() { |
| 242 | 242 | _this.log('oncanplay'); |
| 243 | 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 | - } | |
| 251 | + if(typeof _this.options.canplayCallback == 'function'){ | |
| 252 | + _this.options.canplayCallback({'status': true}); | |
| 255 | 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 | + // } | |
| 256 | 272 | } |
| 257 | 273 | |
| 258 | 274 | // When the browser is downloading audio / 当浏览器正在下载音频时 | ... | ... |
dist/player.html
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <html lang="en"> |
| 3 | 3 | <head> |
| 4 | 4 | <meta charset="UTF-8"> |
| 5 | - <meta name="renderer" content="webkit"> | |
| 5 | + <!-- <meta name="renderer" content="webkit"> --> | |
| 6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui"> |
| 7 | 7 | <title>互动编程</title> |
| 8 | 8 | <link rel="stylesheet" href="css/responsive/css/bootstrap.min.css"> | ... | ... |
dist/scss/mobile.scss
dist/v1.1/player.html
| ... | ... | @@ -187,10 +187,10 @@ |
| 187 | 187 | <script src="../js/05-util.js"></script> |
| 188 | 188 | <script src="../js/03-http.js"></script> |
| 189 | 189 | |
| 190 | - <script type="text/javascript" src="../js/audioPlayer/jQuery.AudioPlayer.js"></script> | |
| 190 | + <script type="text/javascript" src="../js/audioPlayer/jQuery.AudioPlayer.js?v=0.0.3"></script> | |
| 191 | 191 | |
| 192 | 192 | <script src="../js/recorder/Myna.js"></script> |
| 193 | - <script src="../gxb-ide/Dir.js"></script> | |
| 193 | + <script src="../gxb-ide/Dir.js?v=0.0.6"></script> | |
| 194 | 194 | <script src="../gxb-ide/CodingEditer.js"></script> |
| 195 | 195 | <script src="../gxb-ide/Iterm.js"></script> |
| 196 | 196 | <script src="../gxb-ide/Ide.js"></script> | ... | ... |
src/gxb-ide/Dir.js
| ... | ... | @@ -616,7 +616,7 @@ |
| 616 | 616 | if (role == 0) { |
| 617 | 617 | if (playTimes === 0) { |
| 618 | 618 | // 请求玩立刻执行 |
| 619 | - alert('play -----------123 ' + playTimes) | |
| 619 | + // alert('play -----------123 ' + playTimes) | |
| 620 | 620 | $.AudioPlayer.play() |
| 621 | 621 | } |
| 622 | 622 | }else{ |
| ... | ... | @@ -653,15 +653,15 @@ |
| 653 | 653 | debuggers: false, |
| 654 | 654 | allowSeek: false, |
| 655 | 655 | canplayCallback: function(res){ |
| 656 | - alert('res.status ----------- ' + res.status) | |
| 656 | + // alert('res.status ----------- ' + res.status) | |
| 657 | 657 | if (res.status == true) { |
| 658 | - alert('canplayCallback ----------- ' + playTimes) | |
| 658 | + // alert('canplayCallback ----------- ' + playTimes) | |
| 659 | 659 | CodingEditer.playCoding(); |
| 660 | 660 | } |
| 661 | 661 | }, |
| 662 | 662 | onwaitingCallback: function(){ |
| 663 | 663 | if (playTimes != 0) { |
| 664 | - alert('onwaitingCallback ----------- ' + playTimes) | |
| 664 | + // alert('onwaitingCallback ----------- ' + playTimes) | |
| 665 | 665 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 666 | 666 | CodingEditer.pauseCode(); |
| 667 | 667 | }else{ |
| ... | ... | @@ -669,14 +669,14 @@ |
| 669 | 669 | } |
| 670 | 670 | }, |
| 671 | 671 | playCallback: function() { // 播放 |
| 672 | - alert('播放 ----------- ' + playTimes) | |
| 672 | + // alert('播放 ----------- ' + playTimes) | |
| 673 | 673 | if (playTimes != 0) { |
| 674 | - alert('playCallback ----------- ' + playTimes) | |
| 674 | + // alert('playCallback ----------- ' + playTimes) | |
| 675 | 675 | CodingEditer.playCoding(); |
| 676 | 676 | } |
| 677 | 677 | }, |
| 678 | 678 | pauseCallback: function() { // 暂停 |
| 679 | - alert('playCallback ----------- ' + playTimes) | |
| 679 | + // alert('playCallback ----------- ' + playTimes) | |
| 680 | 680 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 681 | 681 | CodingEditer.pauseCode(); |
| 682 | 682 | }, | ... | ... |