The reason is that IOS doesn’t allow autoplay of audio, and there are two solutions

In the main. Js

Vue.prototype.innerAudioContext = uni.createInnerAudioContext(); Prototype. PlayAudio = function(audioUrl) {console.log(' play ') var innerAudioContext = Vue.prototype.innerAudioContext; innerAudioContext.autoplay = true; if (audioUrl) { innerAudioContext = uni.createInnerAudioContext(); Inneraudiocontext.src = audioUrl? audioUrl : 'https://tcb-vue-8gipg3itbc96c957-1254304076.tcloudbaseapp.com/backMusic2.mp3'; // Select audio to play} else {innerAudioContext.src = 'https://tcb-vue-8gipg3itbc96c957-1254304076.tcloudbaseapp.com/backMusic2.mp3'; // Select the audio to play} innerAudioContext.play(); Prototype. PlayStop = function() {console.log(' stop ') var innerAudioContext = Vue.prototype.innerAudioContext; innerAudioContext.stop(); // Execute play}Copy the code

Solution 1: Need to interact with the user, that is, after the user clicks, then call it