Commit bd5df8b330abd85e63e1a4751dc737c0471d2ec0
1 parent
31c40c8e
修改单文件学生录制预览只能播放一遍
Showing
3 changed files
with
49 additions
and
28 deletions
src/js/gb.js
| ... | ... | @@ -1993,7 +1993,6 @@ $(function() { |
| 1993 | 1993 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { |
| 1994 | 1994 | GBCodePlayBack.records[i].trigger = 0; |
| 1995 | 1995 | } |
| 1996 | - // playEnd(); | |
| 1997 | 1996 | } |
| 1998 | 1997 | |
| 1999 | 1998 | if(document.URL.indexOf('index.htm') >= 0) { |
| ... | ... | @@ -2039,7 +2038,6 @@ $(function() { |
| 2039 | 2038 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { |
| 2040 | 2039 | GBCodePlayBack.records[i].trigger = 0; |
| 2041 | 2040 | } |
| 2042 | - // playEnd(); | |
| 2043 | 2041 | } |
| 2044 | 2042 | } |
| 2045 | 2043 | } | ... | ... |
src/js/gbreplayer.js
| ... | ... | @@ -381,34 +381,35 @@ $(function(){ |
| 381 | 381 | compileMode(langid); |
| 382 | 382 | console.log(coderecords); |
| 383 | 383 | $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl); |
| 384 | - player.init({ | |
| 385 | - container: '#audioWrap' | |
| 386 | - ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | |
| 387 | - ,imagePath: 'js/audioPlayer/image' | |
| 388 | - ,debuggers: false | |
| 389 | - ,allowSeek: false | |
| 390 | - ,playCallback: function(){ // 播放 | |
| 391 | - playCode(); | |
| 392 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | |
| 393 | - } | |
| 394 | - ,pauseCallback: function(){ // 暂停 | |
| 395 | - GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 396 | - pauseCode(); | |
| 397 | - GBCodePlayBack.firstPlay = 0; | |
| 398 | - GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | |
| 399 | - GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | |
| 400 | - } | |
| 401 | - ,seekedCallback: function(){} // 拖拽 | |
| 402 | - ,endedCallback: function(){ // 结束播放 | |
| 403 | - playEnd() | |
| 404 | - } | |
| 405 | - }); | |
| 406 | - | |
| 407 | - if (_role == 0) { | |
| 384 | + if (_role ==0) { | |
| 408 | 385 | var coderecords = coderecords.codeRecordList; |
| 409 | - }else if (_role == 1) { | |
| 386 | + player.init({ | |
| 387 | + container: '#audioWrap' | |
| 388 | + ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com" + coderecords.audioUrl | |
| 389 | + ,imagePath: 'js/audioPlayer/image' | |
| 390 | + ,debuggers: false | |
| 391 | + ,allowSeek: false | |
| 392 | + ,playCallback: function(){ // 播放 | |
| 393 | + playCode(); | |
| 394 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', true); | |
| 395 | + } | |
| 396 | + ,pauseCallback: function(){ // 暂停 | |
| 397 | + GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 398 | + pauseCode(); | |
| 399 | + GBCodePlayBack.firstPlay = 0; | |
| 400 | + GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | |
| 401 | + GBCodePlayBack.htmlplayereditor.setOption('readOnly', false); | |
| 402 | + } | |
| 403 | + ,seekedCallback: function(){} // 拖拽 | |
| 404 | + ,endedCallback: function(){ // 结束播放 | |
| 405 | + playEnd() | |
| 406 | + } | |
| 407 | + }); | |
| 408 | + }else{ | |
| 410 | 409 | var coderecords = coderecords.studentRecordList; |
| 410 | + $('.play-code').show(); | |
| 411 | 411 | } |
| 412 | + | |
| 412 | 413 | GBCodePlayBack.htmlplayereditor.setValue(''); |
| 413 | 414 | GBCodePlayBack.cssplayereditor.setValue(''); |
| 414 | 415 | GBCodePlayBack.jsplayereditor.setValue(''); |
| ... | ... | @@ -1323,7 +1324,16 @@ $(function(){ |
| 1323 | 1324 | |
| 1324 | 1325 | |
| 1325 | 1326 | $('#recordertab a:first').tab('show'); |
| 1326 | - Hourglass.stopTimer(); | |
| 1327 | + if(_role == 1){ | |
| 1328 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | |
| 1329 | + GBCodePlayBack.records[i].trigger = 0; | |
| 1330 | + } | |
| 1331 | + // playEnd(); | |
| 1332 | + } | |
| 1333 | + | |
| 1334 | + if(document.URL.indexOf('index.htm') >= 0) { | |
| 1335 | + Hourglass.stopTimer(); | |
| 1336 | + } | |
| 1327 | 1337 | console.log("-----------播放结束------------") |
| 1328 | 1338 | /* 移动设备的下一节和代码编写控制 */ |
| 1329 | 1339 | $('#donenext').removeClass('disabled'); |
| ... | ... | @@ -1360,6 +1370,11 @@ $(function(){ |
| 1360 | 1370 | var $sliderpropress = $(".replayprogress"); |
| 1361 | 1371 | $sliderpropress.slider( "option", "disabled", false ); |
| 1362 | 1372 | $('#excerciselist .ineedautocodehelp').data('status',0).attr('title','播放').find('span').addClass('glyphicon-play-circle').removeClass('glyphicon-stop'); |
| 1373 | + if(_role == 1){ | |
| 1374 | + for (var i = 0; i < GBCodePlayBack.records.length; i++) { | |
| 1375 | + GBCodePlayBack.records[i].trigger = 0; | |
| 1376 | + } | |
| 1377 | + } | |
| 1363 | 1378 | } |
| 1364 | 1379 | } |
| 1365 | 1380 | }, |
| ... | ... | @@ -1549,6 +1564,11 @@ $(function(){ |
| 1549 | 1564 | contrlPause() |
| 1550 | 1565 | }) |
| 1551 | 1566 | |
| 1567 | + $('.play-code').click(function(){ | |
| 1568 | + playCode(); | |
| 1569 | + GBCodePlayBack.editable(0) | |
| 1570 | + }); | |
| 1571 | + | |
| 1552 | 1572 | // 继续录制配置 |
| 1553 | 1573 | function recodingConf(){ |
| 1554 | 1574 | Hourglass.pauseTimer(); | ... | ... |
src/player.html
| ... | ... | @@ -125,6 +125,9 @@ |
| 125 | 125 | </div> |
| 126 | 126 | |
| 127 | 127 | <div class="" id="audioWrap"> |
| 128 | + <button class="play-code" style="display: none;"> | |
| 129 | + <i class="icon iconfont icon-play"></i> | |
| 130 | + </button> | |
| 128 | 131 | <button id="full-screen"> |
| 129 | 132 | <i class="icon iconfont icon-fangda"></i> |
| 130 | 133 | </button> | ... | ... |