|
|
@@ -36,7 +36,6 @@ var intervalSound = 0,
|
|
36
|
36
|
var isCollecting = false;
|
|
37
|
37
|
|
|
38
|
38
|
var isPlaying = false;
|
|
39
|
|
-var innerAudioContext;
|
|
40
|
39
|
|
|
41
|
40
|
var timeoutPlayAudio;
|
|
42
|
41
|
var tempPlayUrl = "";
|
|
|
@@ -74,16 +73,8 @@ Page({
|
|
74
|
73
|
Color: main.getDetailColor(app.globalData.ColorIndex),
|
|
75
|
74
|
});
|
|
76
|
75
|
|
|
|
76
|
+ this.audioCtx = wx.createAudioContext('myAudio');
|
|
77
|
77
|
innerAudioContext1 = wx.createInnerAudioContext();
|
|
78
|
|
-
|
|
79
|
|
- innerAudioContext = wx.createInnerAudioContext();
|
|
80
|
|
- innerAudioContext.onPlay(() => {
|
|
81
|
|
- //console.log('开始播放');
|
|
82
|
|
- });
|
|
83
|
|
- innerAudioContext.onEnded(() => {
|
|
84
|
|
- //console.log('结束播放');
|
|
85
|
|
- });
|
|
86
|
|
-
|
|
87
|
78
|
|
|
88
|
79
|
this.getList();
|
|
89
|
80
|
|
|
|
@@ -139,10 +130,6 @@ Page({
|
|
139
|
130
|
clearInterval(intervalSound);
|
|
140
|
131
|
clearTimeout(timeoutEveryCard);
|
|
141
|
132
|
listTaskFinished = [];
|
|
142
|
|
- if (innerAudioContext) {
|
|
143
|
|
- innerAudioContext.stop();
|
|
144
|
|
- isPlaying = false;
|
|
145
|
|
- }
|
|
146
|
133
|
},
|
|
147
|
134
|
onPullDownRefresh: function () {
|
|
148
|
135
|
this.onShowAnswer({
|
|
|
@@ -386,10 +373,6 @@ Page({
|
|
386
|
373
|
//回到上一张题卡
|
|
387
|
374
|
gotoPrev: function () {
|
|
388
|
375
|
var that = this;
|
|
389
|
|
- if (innerAudioContext) {
|
|
390
|
|
- innerAudioContext.stop();
|
|
391
|
|
- isPlaying = false;
|
|
392
|
|
- }
|
|
393
|
376
|
|
|
394
|
377
|
if (listTaskFinished.length > 0) {
|
|
395
|
378
|
var card = listTaskFinished.pop();
|
|
|
@@ -445,11 +428,6 @@ Page({
|
|
445
|
428
|
//进入下一张题卡
|
|
446
|
429
|
gotoNext: function (e) {
|
|
447
|
430
|
var that = this;
|
|
448
|
|
- if (innerAudioContext) {
|
|
449
|
|
- innerAudioContext.stop();
|
|
450
|
|
- isPlaying = false;
|
|
451
|
|
- }
|
|
452
|
|
-
|
|
453
|
431
|
var btnnumber = e.currentTarget.dataset.btnnumber;
|
|
454
|
432
|
var time = e.currentTarget.dataset.time;
|
|
455
|
433
|
|
|
|
@@ -712,9 +690,7 @@ Page({
|
|
712
|
690
|
timeoutPlayAudio = setTimeout(function () {
|
|
713
|
691
|
isPlaying = false;
|
|
714
|
692
|
}, 60000);
|
|
715
|
|
- if (innerAudioContext) {
|
|
716
|
|
- innerAudioContext.stop();
|
|
717
|
|
- }
|
|
|
693
|
+
|
|
718
|
694
|
wx.showLoading({
|
|
719
|
695
|
title: '音频下载中',
|
|
720
|
696
|
mask: true,
|
|
|
@@ -728,8 +704,8 @@ Page({
|
|
728
|
704
|
success(res) {
|
|
729
|
705
|
wx.hideLoading();
|
|
730
|
706
|
if (res.statusCode === 200) {
|
|
731
|
|
- innerAudioContext.src = res.tempFilePath;
|
|
732
|
|
- innerAudioContext.play();
|
|
|
707
|
+ that.audioCtx.setSrc(res.tempFilePath);
|
|
|
708
|
+ that.audioCtx.play();
|
|
733
|
709
|
tempPlayUrl = url;
|
|
734
|
710
|
}
|
|
735
|
711
|
},
|
|
|
@@ -739,12 +715,13 @@ Page({
|
|
739
|
715
|
});
|
|
740
|
716
|
}
|
|
741
|
717
|
else {
|
|
742
|
|
- if (innerAudioContext) {
|
|
743
|
|
- innerAudioContext.stop();
|
|
744
|
|
- isPlaying = false;
|
|
745
|
|
- }
|
|
|
718
|
+ this.audioCtx.pause();
|
|
|
719
|
+ isPlaying = false;
|
|
746
|
720
|
}
|
|
747
|
721
|
},
|
|
|
722
|
+ audioBindEnded: function () {
|
|
|
723
|
+ isPlaying = false;
|
|
|
724
|
+ },
|
|
748
|
725
|
getTaskTime: function () {
|
|
749
|
726
|
var that = this;
|
|
750
|
727
|
var url = "GetMiaoguoTaskTime?";
|