Commit 6550db7a4cfe6745f4324b2f222e35cf51c962e7
1 parent
d9fdc864
fix signle
Showing
2 changed files
with
20 additions
and
4 deletions
dist/js/gbreplayer.js
| @@ -23,6 +23,10 @@ $(function(){ | @@ -23,6 +23,10 @@ $(function(){ | ||
| 23 | $('#upload').show(); | 23 | $('#upload').show(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | + var u = navigator.userAgent; | ||
| 27 | + var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 | ||
| 28 | + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 | ||
| 29 | + | ||
| 26 | if(document.URL.indexOf('player.htm')>=0){ | 30 | if(document.URL.indexOf('player.htm')>=0){ |
| 27 | 31 | ||
| 28 | var title = decodeURIComponent(getQuery('title')); | 32 | var title = decodeURIComponent(getQuery('title')); |
| @@ -430,7 +434,7 @@ $(function(){ | @@ -430,7 +434,7 @@ $(function(){ | ||
| 430 | ,debuggers: false | 434 | ,debuggers: false |
| 431 | ,allowSeek: false | 435 | ,allowSeek: false |
| 432 | ,canplayCallback: function(res){ | 436 | ,canplayCallback: function(res){ |
| 433 | - if (res.status == true && GBCodePlayBack.playTimes === 0) { | 437 | + if (res.status == true && GBCodePlayBack.playTimes === 0 && !isAndroid) { |
| 434 | playCode(); | 438 | playCode(); |
| 435 | GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | 439 | GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); |
| 436 | GBCodePlayBack.playTimes++ | 440 | GBCodePlayBack.playTimes++ |
| @@ -476,7 +480,11 @@ $(function(){ | @@ -476,7 +480,11 @@ $(function(){ | ||
| 476 | 480 | ||
| 477 | GBCodePlayBack.records = coderecords; | 481 | GBCodePlayBack.records = coderecords; |
| 478 | if(GBCodePlayBack.playTimes === 0){ | 482 | if(GBCodePlayBack.playTimes === 0){ |
| 479 | - player.play(); | 483 | + if(!isAndroid){ |
| 484 | + player.play(); | ||
| 485 | + }else{ | ||
| 486 | + GBCodePlayBack.playTimes++ | ||
| 487 | + } | ||
| 480 | } | 488 | } |
| 481 | } | 489 | } |
| 482 | 490 |
src/js/gbreplayer.js
| @@ -23,6 +23,10 @@ $(function(){ | @@ -23,6 +23,10 @@ $(function(){ | ||
| 23 | $('#upload').show(); | 23 | $('#upload').show(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | + var u = navigator.userAgent; | ||
| 27 | + var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 | ||
| 28 | + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 | ||
| 29 | + | ||
| 26 | if(document.URL.indexOf('player.htm')>=0){ | 30 | if(document.URL.indexOf('player.htm')>=0){ |
| 27 | 31 | ||
| 28 | var title = decodeURIComponent(getQuery('title')); | 32 | var title = decodeURIComponent(getQuery('title')); |
| @@ -430,7 +434,7 @@ $(function(){ | @@ -430,7 +434,7 @@ $(function(){ | ||
| 430 | ,debuggers: false | 434 | ,debuggers: false |
| 431 | ,allowSeek: false | 435 | ,allowSeek: false |
| 432 | ,canplayCallback: function(res){ | 436 | ,canplayCallback: function(res){ |
| 433 | - if (res.status == true && GBCodePlayBack.playTimes === 0) { | 437 | + if (res.status == true && GBCodePlayBack.playTimes === 0 && !isAndroid) { |
| 434 | playCode(); | 438 | playCode(); |
| 435 | GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | 439 | GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); |
| 436 | GBCodePlayBack.playTimes++ | 440 | GBCodePlayBack.playTimes++ |
| @@ -476,7 +480,11 @@ $(function(){ | @@ -476,7 +480,11 @@ $(function(){ | ||
| 476 | 480 | ||
| 477 | GBCodePlayBack.records = coderecords; | 481 | GBCodePlayBack.records = coderecords; |
| 478 | if(GBCodePlayBack.playTimes === 0){ | 482 | if(GBCodePlayBack.playTimes === 0){ |
| 479 | - player.play(); | 483 | + if(!isAndroid){ |
| 484 | + player.play(); | ||
| 485 | + }else{ | ||
| 486 | + GBCodePlayBack.playTimes++ | ||
| 487 | + } | ||
| 480 | } | 488 | } |
| 481 | } | 489 | } |
| 482 | 490 |