安卓手机锁屏了也会播放new.mp3文件,苹果只有在app打开着的情况下才可以,最小化或是锁屏就不行了,是怎么回事?
程序里
if(indexdzc==8){
this.msggo="有新订单!";
this.createMessage(this.msggo);
setTimeout(()=>{
this.ScanAudionew();
}, 3000)
}
main.js文件
Vue.prototype.ScanAudionew = function(){
var pnew = uni.createInnerAudioContext();
pnew.autoplay = true;
pnew.src = '../../static/audio/new.mp3';
pnew.onPlay(() => {
});
setTimeout(()=>{
pnew.stop(() => {
});
},3000)
}
Vue.prototype.createMessage = function(msg){
console.log('消息'+msg);
plus.push.createMessage(msg,'', {
sound:'system'
} );
}
1 个回复
3***@qq.com (作者)
搞好了,因为苹果不能用mp3,把声音转成.caf