Commit 2c30e525409baa3391910adb23a802fdc0d5d5f5
1 parent
bfd4b879
暂停修改代码
Showing
3 changed files
with
53 additions
and
25 deletions
src/js/gbreplayer.js
| ... | ... | @@ -26,12 +26,13 @@ $(function(){ |
| 26 | 26 | excercise_records: [], |
| 27 | 27 | autorun: 1, |
| 28 | 28 | triggertotal: 0, |
| 29 | + firstPlay: 1, // 第一次播放 | |
| 30 | + pauseValue: '', // 存储暂停时内容 | |
| 29 | 31 | triggeroffset: 0, //判断拖动进度条的偏移量 |
| 30 | 32 | excercise_triggertotal: 0, |
| 31 | 33 | replay_enhancement:1, //是否优化播放,即匀速播放 |
| 32 | 34 | replay_enhancement_value: 250, |
| 33 | 35 | speed: 1, |
| 34 | - playstatu: 0, | |
| 35 | 36 | recordtimeoutcontrolls: [], |
| 36 | 37 | excercise_recordtimeoutcontrolls: [], |
| 37 | 38 | isgblibreplay: 0, |
| ... | ... | @@ -384,18 +385,34 @@ $(function(){ |
| 384 | 385 | ,imagePath: 'js/audioPlayer/image' |
| 385 | 386 | ,debuggers: false |
| 386 | 387 | ,allowSeek: false |
| 387 | - ,playCallback: function(){ | |
| 388 | + ,playCallback: function(){ // 播放 | |
| 388 | 389 | // playCoder(); |
| 390 | + | |
| 391 | + console.log(GBCodePlayBack.pauseValue) | |
| 392 | + | |
| 393 | + if (GBCodePlayBack.firstPlay == 0) { | |
| 394 | + $('#readonly').trigger('click'); | |
| 395 | + GBCodePlayBack.htmlplayereditor.setValue(GBCodePlayBack.pauseValue) | |
| 396 | + console.log(GBCodePlayBack.pauseValue); | |
| 397 | + }else{ | |
| 398 | + GBCodePlayBack.htmlplayereditor.setValue('') | |
| 399 | + console.log(GBCodePlayBack.pauseValue); | |
| 400 | + } | |
| 389 | 401 | $('#play').trigger('click'); |
| 390 | - GBCodePlayBack.playstatu = 0; | |
| 402 | + | |
| 391 | 403 | } |
| 392 | - ,pauseCallback: function(){ | |
| 393 | - // playCoder(); | |
| 404 | + ,pauseCallback: function(){ // 暂停 | |
| 405 | + $('#readonly').trigger('click'); | |
| 406 | + | |
| 407 | + GBCodePlayBack.firstPlay = 0; | |
| 408 | + | |
| 409 | + GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); | |
| 410 | + | |
| 394 | 411 | $('#play').trigger('click'); |
| 395 | - GBCodePlayBack.playstatu = 0; | |
| 412 | + | |
| 396 | 413 | } |
| 397 | - ,seekedCallback: function(){} | |
| 398 | - ,endedCallback: function(){ | |
| 414 | + ,seekedCallback: function(){} // 拖拽 | |
| 415 | + ,endedCallback: function(){ // 结束播放 | |
| 399 | 416 | playEnd() |
| 400 | 417 | } |
| 401 | 418 | }); |
| ... | ... | @@ -449,11 +466,6 @@ $(function(){ |
| 449 | 466 | $('#play').find('i').removeClass('icon-play').addClass('icon-playcopy').attr('data-original-title', '暂停'); |
| 450 | 467 | } |
| 451 | 468 | } |
| 452 | - console.log(GBCodePlayBack.playstatu); | |
| 453 | - if(GBCodePlayBack.playstatu = 1){ | |
| 454 | - GBCodePlayBack.htmlplayereditor.setValue(''); | |
| 455 | - } | |
| 456 | - console.log(GBCodePlayBack.playstatu); | |
| 457 | 469 | if(!playstatus){ |
| 458 | 470 | var playbackrecord = GBCodePlayBack.records, |
| 459 | 471 | currenteditor = ''; |
| ... | ... | @@ -1269,11 +1281,11 @@ $(function(){ |
| 1269 | 1281 | |
| 1270 | 1282 | this.resizeWindow($('#ifrcontainer').find('#resultiframe')); |
| 1271 | 1283 | |
| 1272 | - $(window).bind('beforeunload', function(){ | |
| 1284 | + // $(window).bind('beforeunload', function(){ | |
| 1273 | 1285 | |
| 1274 | - return '确认立刻退出? 请确保已录制的代码回放以保存,以防回放数据丢失'; | |
| 1286 | + // return '确认立刻退出? 请确保已录制的代码回放以保存,以防回放数据丢失'; | |
| 1275 | 1287 | |
| 1276 | - }); | |
| 1288 | + // }); | |
| 1277 | 1289 | |
| 1278 | 1290 | /* 解决Chrome浏览器非激活标签页下错乱问题 */ |
| 1279 | 1291 | (function() { |
| ... | ... | @@ -1969,27 +1981,43 @@ $(function(){ |
| 1969 | 1981 | } |
| 1970 | 1982 | }); |
| 1971 | 1983 | } |
| 1972 | - | |
| 1973 | - GBCodePlayBack.triggertotal = 0; | |
| 1974 | - | |
| 1975 | - GBCodePlayBack.playstatu = 1; | |
| 1976 | 1984 | |
| 1985 | + GBCodePlayBack.firstPlay = 1; | |
| 1986 | + GBCodePlayBack.triggertotal = 0; | |
| 1987 | + console.log(GBCodePlayBack.records) | |
| 1977 | 1988 | /* 初始化播放 */ |
| 1978 | 1989 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { |
| 1979 | - GBCodePlayBack.records[i].trigger = 0; | |
| 1980 | - } | |
| 1990 | + GBCodePlayBack.records[i].trigger = 0; | |
| 1991 | + } | |
| 1981 | 1992 | |
| 1982 | 1993 | for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) { |
| 1983 | 1994 | clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]); |
| 1984 | 1995 | } |
| 1985 | 1996 | |
| 1997 | + console.log(GBCodePlayBack.records) | |
| 1986 | 1998 | if($('#readonly').length>0){ |
| 1987 | 1999 | setTimeout(function(){$('#readonly').popover({html:true, placement:'right', container: 'body', content:''}).popover('show');}, 2000); |
| 1988 | - setTimeout(function(){$('#readonly').trigger('click');},1500); | |
| 2000 | + | |
| 2001 | + setTimeout(function(){ | |
| 2002 | + $('#readonly').trigger('click'); | |
| 2003 | + }, 1500); | |
| 2004 | + | |
| 1989 | 2005 | setTimeout(function(){$('#readonly').popover('destroy');}, 5000); |
| 1990 | 2006 | } |
| 1991 | 2007 | } |
| 1992 | 2008 | |
| 2009 | + // 只读和可编辑状态 | |
| 2010 | + function readStatus(roflag) { | |
| 2011 | + if (roflag == 1) { | |
| 2012 | + $('#readonly').trigger('click'); | |
| 2013 | + } else { | |
| 2014 | + $('#readonly').trigger('click'); | |
| 2015 | + console.log('iOS 几分') | |
| 2016 | + } | |
| 2017 | + | |
| 2018 | + } | |
| 2019 | + | |
| 2020 | + | |
| 1993 | 2021 | }); |
| 1994 | 2022 | |
| 1995 | 2023 | ... | ... |
src/player.html
| ... | ... | @@ -141,9 +141,8 @@ |
| 141 | 141 | <button id="play" class="hidden" data-status='0' title="暂停"> |
| 142 | 142 | <i class="icon iconfont icon-playcopy"></i> |
| 143 | 143 | </button> |
| 144 | - | |
| 145 | 144 | </div> |
| 146 | - | |
| 145 | + | |
| 147 | 146 | |
| 148 | 147 | <script type="text/javascript" src="js/audioPlayer/jQuery.AudioPlayer.js"></script> |
| 149 | 148 | ... | ... |