Commit 9b7bbdec5483b49db0f260ad0a2f1dab68fbc2ea

Authored by ykxie
1 parent 96ea1ff6

fix player not second

src/css/recording.css
@@ -512,42 +512,24 @@ button { @@ -512,42 +512,24 @@ button {
512 512
513 #audioWrap { 513 #audioWrap {
514 position: fixed; 514 position: fixed;
515 - bottom: 50px; 515 + bottom: 0;
516 width: 100%; 516 width: 100%;
517 - height: 40px;  
518 - background: #FFF; 517 + height: 48px;
  518 + background-image: url(./image/player_bg2.png);
519 display: flex; 519 display: flex;
520 display: inline-flex; 520 display: inline-flex;
521 z-index: 999; 521 z-index: 999;
522 background-color: #333; 522 background-color: #333;
523 - padding: 0 32px; } 523 + padding: 4px 74px 0 32px;
  524 + box-shadow: 0px 2px 10px #333; }
524 525
525 -.play-bar {  
526 - position: fixed;  
527 - bottom: 0px;  
528 - width: 100%;  
529 - height: 48px;  
530 - background: #FFF;  
531 - display: flex;  
532 - display: inline-flex;  
533 - z-index: 999;  
534 - background-color: #000000; }  
535 - .play-bar button {  
536 - background-color: transparent;  
537 - border: none;  
538 - margin-left: 24px; }  
539 - .play-bar .iconfont {  
540 - color: #FFF;  
541 - font-size: 24px; }  
542 - .play-bar #full-screen, .play-bar #back-screen {  
543 - position: absolute;  
544 - right: 46px;  
545 - margin: 7px 0; }  
546 - .play-bar #play_audio {  
547 - width: 60%;  
548 - margin-left: 24px; }  
549 - .play-bar #playrecord {  
550 - margin-left: 24px; } 526 +#full-screen, #back-screen {
  527 + background: transparent;
  528 + color: #FFF;
  529 + border: transparent;
  530 + position: absolute;
  531 + right: 0;
  532 + margin: 7px 16px; }
551 533
552 .audio-wrap { 534 .audio-wrap {
553 position: relative; } 535 position: relative; }
src/js/audioPlayer/theme.default.css
@@ -26,10 +26,7 @@ @@ -26,10 +26,7 @@
26 background: #333; 26 background: #333;
27 border-right: 1px solid #555; 27 border-right: 1px solid #555;
28 border-right-color: rgba( 255, 255, 255, .1); 28 border-right-color: rgba( 255, 255, 255, .1);
29 - background-image: url(./image/player_bg2.png);  
30 background-repeat: repeat-x; 29 background-repeat: repeat-x;
31 - -webkit-box-shadow: 1px 1px 6px #333;  
32 - box-shadow: 1px 1px 6px #333;  
33 behavior: url(PIE.htc); 30 behavior: url(PIE.htc);
34 cursor: pointer; 31 cursor: pointer;
35 } 32 }
@@ -56,10 +53,7 @@ @@ -56,10 +53,7 @@
56 line-height: 40px; 53 line-height: 40px;
57 border-left: 1px solid #111; 54 border-left: 1px solid #111;
58 border-left: 1px solid rgba( 0, 0, 0, .25); 55 border-left: 1px solid rgba( 0, 0, 0, .25);
59 - background-image: url(./image/player_bg2.png);  
60 background-repeat: repeat-x; 56 background-repeat: repeat-x;
61 - -webkit-box-shadow: 1px 1px 6px #333;  
62 - box-shadow: 1px 1px 6px #333;  
63 behavior: url(PIE.htc); 57 behavior: url(PIE.htc);
64 -webkit-user-select: none; 58 -webkit-user-select: none;
65 user-select: none; 59 user-select: none;
@@ -68,10 +62,7 @@ @@ -68,10 +62,7 @@
68 #componentWrapper .player_progress { 62 #componentWrapper .player_progress {
69 position: relative; 63 position: relative;
70 height: 40px; 64 height: 40px;
71 - background-image: url(./image/player_bg2.png);  
72 background-repeat: repeat-x; 65 background-repeat: repeat-x;
73 - -webkit-box-shadow: 1px 1px 6px #333;  
74 - box-shadow: 1px 1px 6px #333;  
75 behavior: url(PIE.htc); 66 behavior: url(PIE.htc);
76 cursor: pointer; 67 cursor: pointer;
77 flex: 1; 68 flex: 1;
@@ -143,10 +134,7 @@ @@ -143,10 +134,7 @@
143 line-height: 40px; 134 line-height: 40px;
144 border-right: 1px solid #555; 135 border-right: 1px solid #555;
145 border-right: 1px solid rgba( 255, 255, 255, .1); 136 border-right: 1px solid rgba( 255, 255, 255, .1);
146 - background-image: url(./image/player_bg2.png);  
147 background-repeat: repeat-x; 137 background-repeat: repeat-x;
148 - -webkit-box-shadow: 1px 1px 6px #333;  
149 - box-shadow: 1px 1px 6px #333;  
150 behavior: url(PIE.htc); 138 behavior: url(PIE.htc);
151 -webkit-user-select: none; 139 -webkit-user-select: none;
152 user-select: none; 140 user-select: none;
@@ -165,10 +153,7 @@ @@ -165,10 +153,7 @@
165 height: 40px; 153 height: 40px;
166 border-left: 1px solid #111; 154 border-left: 1px solid #111;
167 border-left-color: rgba( 0, 0, 0, .25); 155 border-left-color: rgba( 0, 0, 0, .25);
168 - background-image: url(./image/player_bg2.png);  
169 background-repeat: repeat-x; 156 background-repeat: repeat-x;
170 - -webkit-box-shadow: 1px 1px 6px #333;  
171 - box-shadow: 1px 1px 6px #333;  
172 behavior: url(PIE.htc); 157 behavior: url(PIE.htc);
173 cursor: pointer; 158 cursor: pointer;
174 } 159 }
@@ -192,8 +177,6 @@ @@ -192,8 +177,6 @@
192 height: 40px; 177 height: 40px;
193 background-image: url(./image/player_bg2_vol.png); 178 background-image: url(./image/player_bg2_vol.png);
194 background-repeat: repeat-x; 179 background-repeat: repeat-x;
195 - -webkit-box-shadow: 1px 1px 6px #333;  
196 - box-shadow: 1px 1px 6px #333;  
197 behavior: url(PIE.htc); 180 behavior: url(PIE.htc);
198 /*display: none;*/ 181 /*display: none;*/
199 cursor: pointer; 182 cursor: pointer;
src/js/gbreplayer.js
@@ -382,9 +382,8 @@ $(function(){ @@ -382,9 +382,8 @@ $(function(){
382 ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl 382 ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl
383 ,imagePath: 'js/audioPlayer/image' 383 ,imagePath: 'js/audioPlayer/image'
384 ,debuggers: false 384 ,debuggers: false
385 - ,allowSeek: true 385 + ,allowSeek: false
386 ,playCallback: function(){ 386 ,playCallback: function(){
387 - console.log(GBCodePlayBack.records)  
388 playCoder(); 387 playCoder();
389 } 388 }
390 ,pauseCallback: function(){ 389 ,pauseCallback: function(){
@@ -392,7 +391,7 @@ $(function(){ @@ -392,7 +391,7 @@ $(function(){
392 } 391 }
393 ,seekedCallback: function(){} 392 ,seekedCallback: function(){}
394 ,endedCallback: function(){ 393 ,endedCallback: function(){
395 - 394 + playEnd()
396 } 395 }
397 }); 396 });
398 397
@@ -419,10 +418,6 @@ $(function(){ @@ -419,10 +418,6 @@ $(function(){
419 }); 418 });
420 } 419 }
421 420
422 - function play(){}  
423 -  
424 -  
425 -  
426 // 使编辑器满屏 421 // 使编辑器满屏
427 setTimeout(function(){ 422 setTimeout(function(){
428 $("#htmlbutton").trigger('click'); 423 $("#htmlbutton").trigger('click');
@@ -431,6 +426,7 @@ $(function(){ @@ -431,6 +426,7 @@ $(function(){
431 /* #STRAT: 播放和暂停控制元素 */ 426 /* #STRAT: 播放和暂停控制元素 */
432 $('#play').click(function(){ 427 $('#play').click(function(){
433 var myAudio = $('#play_audio'); 428 var myAudio = $('#play_audio');
  429 +
434 //禁用修改 430 //禁用修改
435 if(!$('#replaydone').data("readonly")){ 431 if(!$('#replaydone').data("readonly")){
436 $('#replaydone').trigger('click'); 432 $('#replaydone').trigger('click');
@@ -542,23 +538,19 @@ $(function(){ @@ -542,23 +538,19 @@ $(function(){
542 GBCodePlayBack.triggertotal = 0; 538 GBCodePlayBack.triggertotal = 0;
543 539
544 /* 初始化播放 */ 540 /* 初始化播放 */
545 - for(var i=0;i<playbackrecord.length;i++){  
546 - playbackrecord[i].trigger = 0;  
547 - } 541 + for (var i = 0; i < playbackrecord.length; i++) {
  542 + playbackrecord[i].trigger = 0;
  543 + }
548 544
549 - for(var i=0;i<GBCodePlayBack.recordtimeoutcontrolls.length;i++){  
550 - clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);  
551 - }  
552 - 545 + for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) {
  546 + clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
  547 + }
553 GBCodePlayBack.recordtimeoutcontrolls = []; 548 GBCodePlayBack.recordtimeoutcontrolls = [];
554 /* END 初始化播放 */ 549 /* END 初始化播放 */
555 GBCodePlayBack.htmlplayereditor.setValue(''); 550 GBCodePlayBack.htmlplayereditor.setValue('');
556 - GBCodePlayBack.cssplayereditor.setValue('');  
557 - GBCodePlayBack.jsplayereditor.setValue('');  
558 551
559 playbtn.data('status', 0); 552 playbtn.data('status', 0);
560 - $('#play').trigger('click');  
561 - 553 + $('#play').trigger('click');
562 }); 554 });
563 555
564 //setting speed in cookie 556 //setting speed in cookie
@@ -617,6 +609,7 @@ $(function(){ @@ -617,6 +609,7 @@ $(function(){
617 // 根据不同的角色请求不同的接口播放 609 // 根据不同的角色请求不同的接口播放
618 $('#playrecord').hide(); 610 $('#playrecord').hide();
619 $('#play').show(); 611 $('#play').show();
  612 + GBCodePlayBack.htmlplayereditor.setValue('');
620 $('#play').trigger('click'); 613 $('#play').trigger('click');
621 // playCoder() 614 // playCoder()
622 }); 615 });
@@ -1407,6 +1400,7 @@ $(function(){ @@ -1407,6 +1400,7 @@ $(function(){
1407 1400
1408 if (record.compile) { 1401 if (record.compile) {
1409 console.log(record.compile) 1402 console.log(record.compile)
  1403 + console.log('***************************************************')
1410 var resultData = record.compile 1404 var resultData = record.compile
1411 compileResult(resultData) 1405 compileResult(resultData)
1412 } 1406 }
@@ -1629,27 +1623,38 @@ $(function(){ @@ -1629,27 +1623,38 @@ $(function(){
1629 1623
1630 1624
1631 // 播放页面-结束播放事件 1625 // 播放页面-结束播放事件
1632 - if (document.URL.indexOf('player.html') >= 0) {  
1633 - var play_audio = document.getElementById('play_audio');  
1634 - play_audio.addEventListener("ended", function() {  
1635 - console.log(GBCodePlayBack.records)  
1636 - console.log('结束播放')  
1637 - $('#play').hide();  
1638 - $('#playrecord').show();  
1639 - if (_role == 0) {  
1640 - $.ajax({  
1641 - type: "PUT",  
1642 - url: gxb_api + "/programming/learn/chapter/" + _chapterId + "/user/" + _userId,  
1643 - success: function(data){  
1644 - },  
1645 - error: function(){  
1646 - console.log('')  
1647 - }  
1648 - });  
1649 - }  
1650 -  
1651 - }, false);  
1652 - } 1626 + // if (document.URL.indexOf('player.html') >= 0) {
  1627 + // var play_audio = document.getElementById('play_audio');
  1628 + // play_audio.addEventListener("ended", function() {
  1629 + // console.log(GBCodePlayBack.records)
  1630 + // console.log('结束播放')
  1631 + // $('#play').hide();
  1632 + // $('#playrecord').show();
  1633 + // if (_role == 0) {
  1634 + // $.ajax({
  1635 + // type: "PUT",
  1636 + // url: gxb_api + "/programming/learn/chapter/" + _chapterId + "/user/" + _userId,
  1637 + // success: function(data){
  1638 + // },
  1639 + // error: function(){
  1640 + // console.log('')
  1641 + // }
  1642 + // });
  1643 + // }
  1644 +
  1645 + // GBCodePlayBack.triggertotal = 0;
  1646 +
  1647 + // /* 初始化播放 */
  1648 + // for (var i = 0; i < GBCodePlayBack.records.length; i++) {
  1649 + // GBCodePlayBack.records[i].trigger = 0;
  1650 + // }
  1651 +
  1652 + // for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) {
  1653 + // clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
  1654 + // }
  1655 +
  1656 + // }, false);
  1657 + // }
1653 1658
1654 1659
1655 // 开始录制 1660 // 开始录制
@@ -1742,7 +1747,7 @@ $(function(){ @@ -1742,7 +1747,7 @@ $(function(){
1742 1747
1743 // 播发代码 1748 // 播发代码
1744 function playCoder(){ 1749 function playCoder(){
1745 - console.log(GBCodePlayBack.records) 1750 + GBCodePlayBack.htmlplayereditor.setValue('');
1746 var myAudio = $('#play_audio'); 1751 var myAudio = $('#play_audio');
1747 //禁用修改 1752 //禁用修改
1748 if(!$('#replaydone').data("readonly")){ 1753 if(!$('#replaydone').data("readonly")){
@@ -1752,16 +1757,16 @@ $(function(){ @@ -1752,16 +1757,16 @@ $(function(){
1752 $('#recordertab a:eq(1)').tab('show'); 1757 $('#recordertab a:eq(1)').tab('show');
1753 1758
1754 var playstatus = $('#play').data('status'); 1759 var playstatus = $('#play').data('status');
1755 - if(document.URL.indexOf('player.html')>=0){  
1756 - if(playstatus){  
1757 - GBCodePlayBack.pauseData = new Date().getTime(); // 暂停的时间  
1758 - myAudio[0].pause();  
1759 - $('#play').find('i').removeClass('icon-playcopy').addClass('icon-play').attr('data-original-title', '播放');  
1760 - }else{  
1761 - myAudio[0].play();  
1762 - $('#play').find('i').removeClass('icon-play').addClass('icon-playcopy').attr('data-original-title', '暂停');  
1763 - }  
1764 - } 1760 + // if(document.URL.indexOf('player.html')>=0){
  1761 + // if(playstatus){
  1762 + // GBCodePlayBack.pauseData = new Date().getTime(); // 暂停的时间
  1763 + // myAudio[0].pause();
  1764 + // $('#play').find('i').removeClass('icon-playcopy').addClass('icon-play').attr('data-original-title', '播放');
  1765 + // }else{
  1766 + // myAudio[0].play();
  1767 + // $('#play').find('i').removeClass('icon-play').addClass('icon-playcopy').attr('data-original-title', '暂停');
  1768 + // }
  1769 + // }
1765 1770
1766 if(!playstatus){ 1771 if(!playstatus){
1767 var playbackrecord = GBCodePlayBack.records, 1772 var playbackrecord = GBCodePlayBack.records,
@@ -1922,6 +1927,33 @@ $(function(){ @@ -1922,6 +1927,33 @@ $(function(){
1922 recorder.pause(); // 继续录制 1927 recorder.pause(); // 继续录制
1923 } 1928 }
1924 1929
  1930 + function playEnd(){
  1931 + $('#play').hide();
  1932 + $('#playrecord').show();
  1933 + if (_role == 0) {
  1934 + $.ajax({
  1935 + type: "PUT",
  1936 + url: gxb_api + "/programming/learn/chapter/" + _chapterId + "/user/" + _userId,
  1937 + success: function(data){
  1938 + },
  1939 + error: function(){
  1940 + console.log('')
  1941 + }
  1942 + });
  1943 + }
  1944 +
  1945 + GBCodePlayBack.triggertotal = 0;
  1946 +
  1947 + /* 初始化播放 */
  1948 + for (var i = 0; i < GBCodePlayBack.records.length; i++) {
  1949 + GBCodePlayBack.records[i].trigger = 0;
  1950 + }
  1951 +
  1952 + for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) {
  1953 + clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
  1954 + }
  1955 + }
  1956 +
1925 }); 1957 });
1926 1958
1927 1959
src/js/recorder/Myna.js
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 5
6 var HZRecorder = function(stream, config) { 6 var HZRecorder = function(stream, config) {
7 config = config || {}; 7 config = config || {};
8 - config.sampleBits = config.sampleBits || 16; //采样数位 8, 16  
9 - config.sampleRate = config.sampleRate || (44100 / 6); //采样率(1/6 44100) 8 + config.sampleBits = config.sampleBits || 8; //采样数位 8, 16
  9 + config.sampleRate = config.sampleRate || 44100; //采样率(1/6 44100)
10 10
11 var context = new(window.webkitAudioContext || window.AudioContext)(); 11 var context = new(window.webkitAudioContext || window.AudioContext)();
12 var audioInput = context.createMediaStreamSource(stream); 12 var audioInput = context.createMediaStreamSource(stream);
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 size: 0, //录音文件长度 17 size: 0, //录音文件长度
18 buffer: [], //录音缓存 18 buffer: [], //录音缓存
19 inputSampleRate: context.sampleRate, //输入采样率 19 inputSampleRate: context.sampleRate, //输入采样率
20 - inputSampleBits: 16, //输入采样数位 8, 16 20 + inputSampleBits: 8, //输入采样数位 8, 16
21 outputSampleRate: config.sampleRate, //输出采样率 21 outputSampleRate: config.sampleRate, //输出采样率
22 oututSampleBits: config.sampleBits, //输出采样数位 8, 16 22 oututSampleBits: config.sampleBits, //输出采样数位 8, 16
23 input: function(data) { 23 input: function(data) {
src/player.html
@@ -130,11 +130,19 @@ @@ -130,11 +130,19 @@
130 </div> 130 </div>
131 </div> 131 </div>
132 132
133 - <div class="" id="audioWrap" style="bottom: 50px;"> 133 + <div class="" id="audioWrap">
134 134
  135 + <button id="full-screen">
  136 + <i class="icon iconfont icon-fangda"></i>
  137 + </button>
  138 + <button id="back-screen" style="display: none;">
  139 + <i class="icon iconfont icon-fangda"></i>
  140 + </button>
135 </div> 141 </div>
136 -  
137 - <div class="play-bar"> 142 + <button id="play" class="" style="display: none;" data-status='0' title="暂停">
  143 + <i class="icon iconfont icon-playcopy"></i>
  144 + </button>
  145 +<!-- <div class="play-bar">
138 <button id="playrecord" data-status='0' title="播放"> 146 <button id="playrecord" data-status='0' title="播放">
139 <i class="icon iconfont icon-play"></i> 147 <i class="icon iconfont icon-play"></i>
140 </button> 148 </button>
@@ -146,13 +154,8 @@ @@ -146,13 +154,8 @@
146 <div class="audio-disable"></div> 154 <div class="audio-disable"></div>
147 <div class="shadow"></div> 155 <div class="shadow"></div>
148 </div> 156 </div>
149 - <button id="full-screen">  
150 - <i class="icon iconfont icon-fangda"></i>  
151 - </button>  
152 - <button id="back-screen">  
153 - <i class="icon iconfont icon-fangda"></i>  
154 - </button>  
155 - </div> 157 +
  158 + </div> -->
156 </div> 159 </div>
157 160
158 161
src/scss/recording.scss
@@ -669,51 +669,28 @@ button{ @@ -669,51 +669,28 @@ button{
669 // Player 样式 669 // Player 样式
670 #audioWrap{ 670 #audioWrap{
671 position: fixed; 671 position: fixed;
672 - bottom: 50px; 672 + bottom: 0;
673 width: 100%; 673 width: 100%;
674 - height: 40px;  
675 - background: #FFF; 674 + height: 48px;
  675 + background-image: url(./image/player_bg2.png);
676 display: flex; 676 display: flex;
677 display: inline-flex; 677 display: inline-flex;
678 z-index: 999; 678 z-index: 999;
679 background-color: #333; 679 background-color: #333;
680 - padding: 0 32px; 680 + padding: 4px 74px 0 32px;
  681 + box-shadow: 0px 2px 10px #333;
681 } 682 }
682 683
683 684
684 -.play-bar{  
685 - position: fixed;  
686 - bottom: 0px;  
687 - width: 100%;  
688 - height: 48px;  
689 - background: #FFF;  
690 - display: flex;  
691 - display: inline-flex;  
692 - z-index: 999;  
693 - background-color: #000000;  
694 -  
695 - button{  
696 - background-color: transparent;  
697 - border: none;  
698 - margin-left: 24px;  
699 - }  
700 - .iconfont{  
701 - color: #FFF;  
702 - font-size: 24px;  
703 - }  
704 - #full-screen, #back-screen{  
705 - position: absolute;  
706 - right: 46px;  
707 - margin: 7px 0;  
708 - }  
709 - #play_audio{  
710 - width: 60%;  
711 - margin-left: 24px;  
712 - }  
713 - #playrecord{  
714 - margin-left: 24px;  
715 - } 685 +#full-screen, #back-screen{
  686 + background: transparent;
  687 + color: #FFF;
  688 + border: transparent;
  689 + position: absolute;
  690 + right: 0;
  691 + margin: 7px 16px;
716 } 692 }
  693 +
717 694
718 695
719 // Player 696 // Player