<template>
<view>
</view>
</template>
<script>
var innerAudioContext1 = null;
var innerAudioContext2 = null;
export default {
data() {
return {
};
},
onReady() {
innerAudioContext1 = uni.createInnerAudioContext();
innerAudioContext2 = uni.createInnerAudioContext();
innerAudioContext1.autoplay = true;
innerAudioContext1.volume = 1;
innerAudioContext2.autoplay = true;
innerAudioContext2.volume = 1;
innerAudioContext1.src = 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3';
innerAudioContext2.src = 'https://qieryi.oss-cn-shenzhen.aliyuncs.com/test/audio/8sx6dSSC4d.mp3';
innerAudioContext1.play();
innerAudioContext2.play();
innerAudioContext1.onPlay(() => {
console.log('开始播放1');
});
innerAudioContext2.onPlay(() => {
console.log('开始播放2');
});
},
methods: {
}
};
</script>
<style>
</style>
6***@qq.com (作者)
好的,谢谢
2022-02-07 15:51
6***@qq.com (作者)
如果用这个同时播放,还会引发什么问题啊?大佬可以说下吗?
2022-02-07 15:52
r***@foxmail.com
audio.sessionCategory = "ambient" 还是会终止其他播放
2024-03-17 23:36