Commit 2c32cfe90c1202ffe4679f64ca17e2549b802652
1 parent
2084f7b2
fix audio
Showing
7 changed files
with
46 additions
and
22 deletions
dist/css/mobile.css
| @@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
| 54 | #playFooter { | 54 | #playFooter { |
| 55 | height: 40px; | 55 | height: 40px; |
| 56 | background-color: rgba(0, 0, 0, 0.5); | 56 | background-color: rgba(0, 0, 0, 0.5); |
| 57 | - padding: 0px 24px; } | 57 | + padding: 0px 4px; } |
| 58 | .console-wrap #toolbar .func { | 58 | .console-wrap #toolbar .func { |
| 59 | height: 56px; | 59 | height: 56px; |
| 60 | padding-top: 0; | 60 | padding-top: 0; |
dist/gxb-ide/Dir.js
| @@ -616,8 +616,8 @@ | @@ -616,8 +616,8 @@ | ||
| 616 | if (role == 0) { | 616 | if (role == 0) { |
| 617 | if (playTimes === 0) { | 617 | if (playTimes === 0) { |
| 618 | // 请求玩立刻执行 | 618 | // 请求玩立刻执行 |
| 619 | + // alert('play -----------123 ' + playTimes) | ||
| 619 | $.AudioPlayer.play() | 620 | $.AudioPlayer.play() |
| 620 | - playTimes++ | ||
| 621 | } | 621 | } |
| 622 | }else{ | 622 | }else{ |
| 623 | CodingEditer.playCoding(); | 623 | CodingEditer.playCoding(); |
| @@ -653,22 +653,30 @@ | @@ -653,22 +653,30 @@ | ||
| 653 | debuggers: false, | 653 | debuggers: false, |
| 654 | allowSeek: false, | 654 | allowSeek: false, |
| 655 | canplayCallback: function(res){ | 655 | canplayCallback: function(res){ |
| 656 | + // alert('res.status ----------- ' + res.status) | ||
| 656 | if (res.status == true) { | 657 | if (res.status == true) { |
| 658 | + // alert('canplayCallback ----------- ' + playTimes) | ||
| 657 | CodingEditer.playCoding(); | 659 | CodingEditer.playCoding(); |
| 658 | } | 660 | } |
| 659 | }, | 661 | }, |
| 660 | onwaitingCallback: function(){ | 662 | onwaitingCallback: function(){ |
| 661 | if (playTimes != 0) { | 663 | if (playTimes != 0) { |
| 664 | + // alert('onwaitingCallback ----------- ' + playTimes) | ||
| 662 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); | 665 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 663 | CodingEditer.pauseCode(); | 666 | CodingEditer.pauseCode(); |
| 667 | + }else{ | ||
| 668 | + playTimes++ | ||
| 664 | } | 669 | } |
| 665 | }, | 670 | }, |
| 666 | playCallback: function() { // 播放 | 671 | playCallback: function() { // 播放 |
| 672 | + // alert('播放 ----------- ' + playTimes) | ||
| 667 | if (playTimes != 0) { | 673 | if (playTimes != 0) { |
| 674 | + // alert('playCallback ----------- ' + playTimes) | ||
| 668 | CodingEditer.playCoding(); | 675 | CodingEditer.playCoding(); |
| 669 | } | 676 | } |
| 670 | }, | 677 | }, |
| 671 | pauseCallback: function() { // 暂停 | 678 | pauseCallback: function() { // 暂停 |
| 679 | + // alert('playCallback ----------- ' + playTimes) | ||
| 672 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); | 680 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 673 | CodingEditer.pauseCode(); | 681 | CodingEditer.pauseCode(); |
| 674 | }, | 682 | }, |
dist/js/audioPlayer/jQuery.AudioPlayer.js
| @@ -241,18 +241,34 @@ | @@ -241,18 +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 | - } | 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 | // When the browser is downloading audio / 当浏览器正在下载音频时 | 274 | // When the browser is downloading audio / 当浏览器正在下载音频时 |
dist/player.html
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <html lang="en"> | 2 | <html lang="en"> |
| 3 | <head> | 3 | <head> |
| 4 | <meta charset="UTF-8"> | 4 | <meta charset="UTF-8"> |
| 5 | - <meta name="renderer" content="webkit"> | 5 | + <!-- <meta name="renderer" content="webkit"> --> |
| 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"> | 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 | <title>互动编程</title> | 7 | <title>互动编程</title> |
| 8 | <link rel="stylesheet" href="css/responsive/css/bootstrap.min.css"> | 8 | <link rel="stylesheet" href="css/responsive/css/bootstrap.min.css"> |
dist/scss/mobile.scss
| @@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
| 71 | #playFooter { | 71 | #playFooter { |
| 72 | height: 40px; | 72 | height: 40px; |
| 73 | background-color: rgba(0,0,0,0.5); | 73 | background-color: rgba(0,0,0,0.5); |
| 74 | - padding: 0px 24px; | 74 | + padding: 0px 4px; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | .console-wrap #toolbar .func { | 77 | .console-wrap #toolbar .func { |
dist/v1.1/player.html
| @@ -187,10 +187,10 @@ | @@ -187,10 +187,10 @@ | ||
| 187 | <script src="../js/05-util.js"></script> | 187 | <script src="../js/05-util.js"></script> |
| 188 | <script src="../js/03-http.js"></script> | 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 | <script src="../js/recorder/Myna.js"></script> | 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 | <script src="../gxb-ide/CodingEditer.js"></script> | 194 | <script src="../gxb-ide/CodingEditer.js"></script> |
| 195 | <script src="../gxb-ide/Iterm.js"></script> | 195 | <script src="../gxb-ide/Iterm.js"></script> |
| 196 | <script src="../gxb-ide/Ide.js"></script> | 196 | <script src="../gxb-ide/Ide.js"></script> |
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 -----------123 ' + playTimes) | 619 | + // alert('play -----------123 ' + playTimes) |
| 620 | $.AudioPlayer.play() | 620 | $.AudioPlayer.play() |
| 621 | } | 621 | } |
| 622 | }else{ | 622 | }else{ |
| @@ -653,15 +653,15 @@ | @@ -653,15 +653,15 @@ | ||
| 653 | debuggers: false, | 653 | debuggers: false, |
| 654 | allowSeek: false, | 654 | allowSeek: false, |
| 655 | canplayCallback: function(res){ | 655 | canplayCallback: function(res){ |
| 656 | - alert('res.status ----------- ' + res.status) | 656 | + // alert('res.status ----------- ' + res.status) |
| 657 | if (res.status == true) { | 657 | if (res.status == true) { |
| 658 | - alert('canplayCallback ----------- ' + playTimes) | 658 | + // alert('canplayCallback ----------- ' + playTimes) |
| 659 | CodingEditer.playCoding(); | 659 | CodingEditer.playCoding(); |
| 660 | } | 660 | } |
| 661 | }, | 661 | }, |
| 662 | onwaitingCallback: function(){ | 662 | onwaitingCallback: function(){ |
| 663 | if (playTimes != 0) { | 663 | if (playTimes != 0) { |
| 664 | - alert('onwaitingCallback ----------- ' + playTimes) | 664 | + // alert('onwaitingCallback ----------- ' + playTimes) |
| 665 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); | 665 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 666 | CodingEditer.pauseCode(); | 666 | CodingEditer.pauseCode(); |
| 667 | }else{ | 667 | }else{ |
| @@ -669,14 +669,14 @@ | @@ -669,14 +669,14 @@ | ||
| 669 | } | 669 | } |
| 670 | }, | 670 | }, |
| 671 | playCallback: function() { // 播放 | 671 | playCallback: function() { // 播放 |
| 672 | - alert('播放 ----------- ' + playTimes) | 672 | + // alert('播放 ----------- ' + playTimes) |
| 673 | if (playTimes != 0) { | 673 | if (playTimes != 0) { |
| 674 | - alert('playCallback ----------- ' + playTimes) | 674 | + // alert('playCallback ----------- ' + playTimes) |
| 675 | CodingEditer.playCoding(); | 675 | CodingEditer.playCoding(); |
| 676 | } | 676 | } |
| 677 | }, | 677 | }, |
| 678 | pauseCallback: function() { // 暂停 | 678 | pauseCallback: function() { // 暂停 |
| 679 | - alert('playCallback ----------- ' + playTimes) | 679 | + // alert('playCallback ----------- ' + playTimes) |
| 680 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); | 680 | CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000); |
| 681 | CodingEditer.pauseCode(); | 681 | CodingEditer.pauseCode(); |
| 682 | }, | 682 | }, |