Browse Source

答题失败后音频播放

h5_css
蟑螂恶霸 3 years ago
parent
commit
9a7d7d6de9
  1. 8
      components/s-video/s-video.vue
  2. BIN
      static/videos/supermario.mp3

8
components/s-video/s-video.vue

@ -77,6 +77,7 @@
showLayer: false, showLayer: false,
isResVideo: false, isResVideo: false,
failUrl: uni.$http.baseUrl +"/profile//images/fail.gif", failUrl: uni.$http.baseUrl +"/profile//images/fail.gif",
innerAudioContext: null,
}; };
}, },
computed: { computed: {
@ -106,6 +107,10 @@
} }
}); });
this.innerAudioContext = uni.createInnerAudioContext();
this.innerAudioContext.autoplay = true;
this.innerAudioContext.src = "/static/videos/supermario.mp3";
// this.videoContext = uni.createVideoContext("video_play"); // this.videoContext = uni.createVideoContext("video_play");
// this.videoContext.requestFullScreen(); // this.videoContext.requestFullScreen();
// this.getBindJson(); // this.getBindJson();
@ -161,6 +166,7 @@
// 不为空表示答题错误展示返回重新选择 // 不为空表示答题错误展示返回重新选择
this.resCheck = true; this.resCheck = true;
this.question = false; this.question = false;
this.innerAudioContext.play();
} }
} }
}, },
@ -174,6 +180,7 @@
this.resCheck = false; this.resCheck = false;
this.resVideoUrl = ""; this.resVideoUrl = "";
this.isResVideo = true; this.isResVideo = true;
this.innerAudioContext.stop();
}, },
onMetadataLoaded(event) { onMetadataLoaded(event) {
if(this.isResVideo) { if(this.isResVideo) {
@ -183,6 +190,7 @@
} }
}, },
nextQuestion(outId, obj) { nextQuestion(outId, obj) {
this.innerAudioContext.stop();
// 点击开始后先增加题次 // 点击开始后先增加题次
if (2 == outId) { if (2 == outId) {
this.$api.addQuestionFre({ this.$api.addQuestionFre({

BIN
static/videos/supermario.mp3

Binary file not shown.
Loading…
Cancel
Save