|
@@ -115,27 +115,34 @@ export default {
|
|
|
},
|
|
|
//数据初次加载
|
|
|
init() {
|
|
|
- const curAudio = this.$store.state.audioBg.list;
|
|
|
- if (this.globalBgAudioManager.src != curAudio.Url) {
|
|
|
- this.$store.commit("audioBg/setMultiple", 1);
|
|
|
- this.globalBgAudioManager.src = curAudio.Url;
|
|
|
- this.globalBgAudioManager.title = curAudio.Name;
|
|
|
- this.$store.commit("audioBg/updateAudioTime", 0);
|
|
|
- console.log("进来了?");
|
|
|
+ let delyTime = 0;
|
|
|
+ if (this.showAudioPop) {
|
|
|
+ console.log(123,'showAudioPop');
|
|
|
+ this.globalBgAudioManager.stop();
|
|
|
+ delyTime = 300;
|
|
|
}
|
|
|
- this.globalBgAudioManager.playbackRate = this.isTimes;
|
|
|
- this.audioTime = curAudio.PlaySeconds;
|
|
|
- this.title = curAudio.Name;
|
|
|
- this.activityTitle = this.$store.state.audioBg.activityTitle;
|
|
|
- this.curTime = this.$store.state.audioBg.curTime;
|
|
|
- // console.log(this.curTime, this.globalBgAudioManager.currentTime, this.$store.state.audioBg.curTime);
|
|
|
- this.play = !this.globalBgAudioManager.paused;
|
|
|
- this.listenAudio();
|
|
|
+ const curAudio = this.$store.state.audioBg.list;
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.globalBgAudioManager.src != curAudio.Url) {
|
|
|
+ this.globalBgAudioManager.src = curAudio.Url;
|
|
|
+ this.globalBgAudioManager.title = curAudio.Name;
|
|
|
+ this.$store.commit("audioBg/updateAudioTime", 0);
|
|
|
+ this.$store.commit("audioBg/setMultiple", 1);
|
|
|
+ }
|
|
|
+ this.globalBgAudioManager.playbackRate = this.isTimes;
|
|
|
+ this.audioTime = curAudio.PlaySeconds;
|
|
|
+ this.title = curAudio.Name;
|
|
|
+ this.activityTitle = this.$store.state.audioBg.activityTitle;
|
|
|
+ this.curTime = this.$store.state.audioBg.curTime;
|
|
|
+ this.play = !this.globalBgAudioManager.paused;
|
|
|
+ this.listenAudio();
|
|
|
+ }, delyTime);
|
|
|
},
|
|
|
//音频播放事件
|
|
|
listenAudio() {
|
|
|
+ console.log('执行了');
|
|
|
this.globalBgAudioManager.onPlay(async () => {
|
|
|
- console.log("onPlay", 123);
|
|
|
+ console.log("onPlay");
|
|
|
this.play = true;
|
|
|
this.$store.commit("audioBg/updateAudioPause", false);
|
|
|
if (this.$store.state.audioBg.activityId) {
|
|
@@ -143,24 +150,26 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
this.globalBgAudioManager.onPause(() => {
|
|
|
- console.log("音频暂停", 123);
|
|
|
+ console.log("音频暂停");
|
|
|
this.play = false;
|
|
|
this.$store.commit("audioBg/updateAudioPause", true);
|
|
|
});
|
|
|
this.globalBgAudioManager.onStop(() => {
|
|
|
console.log("音频停止");
|
|
|
- uni.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- if (res.osName == "ios") {
|
|
|
- console.log("ios");
|
|
|
- this.play = false;
|
|
|
- this.$store.commit("audioBg/removeAudio");
|
|
|
- } else {
|
|
|
- this.play = false;
|
|
|
- this.$store.commit("audioBg/updateAudioPause", true);
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
+ this.$store.commit("audioBg/removeAudio");
|
|
|
+
|
|
|
+ // uni.getSystemInfo({
|
|
|
+ // success: (res) => {
|
|
|
+ // if (res.osName == "ios") {
|
|
|
+ // console.log("ios");
|
|
|
+ // this.play = false;
|
|
|
+ // this.$store.commit("audioBg/removeAudio");
|
|
|
+ // } else {
|
|
|
+ // this.play = false;
|
|
|
+ // this.$store.commit("audioBg/updateAudioPause", true);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // });
|
|
|
});
|
|
|
this.globalBgAudioManager.onEnded(() => {
|
|
|
console.log("音频onEnded");
|
|
@@ -205,11 +214,9 @@ export default {
|
|
|
isTimesHandler(i) {
|
|
|
let index = i == 3 ? 0 : i + 1;
|
|
|
this.$store.commit("audioBg/setMultiple", this.timesTheSpeed[index].value);
|
|
|
- this.globalBgAudioManager.pause();
|
|
|
- this.play = true;
|
|
|
this.globalBgAudioManager.playbackRate = this.isTimes;
|
|
|
this.globalBgAudioManager.startTime = this.curTime;
|
|
|
- this.globalBgAudioManager.play();
|
|
|
+ this.play = true;
|
|
|
},
|
|
|
//快进 快退
|
|
|
speedReverseHandler(type) {
|