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

BIN
static/videos/supermario.mp3

Binary file not shown.
Loading…
Cancel
Save