vue上传录音_vue用到H5+的录音功能 真机模拟的时候不能实现
vue用到H5+的录音功能 真机模拟的时候不能实现录音,报错plusready is not undefined 但是官方的demo中audio文件在真机模拟的时候是能够实现录音的。
export default {
data(){
return {
r: ' '
}
},
created(){
this.load()
},
methods: {
load(){
if(window.plus){
this.plusReady();
}else{
document.addEventListener('plusready', this.plusReady, false);
}
},
// 扩展API加载完毕,现在可以正常调用扩展API
plusReady() {
this. r = plus.audio.getRecorder();
},
startRecord() {
if (this.r == null) {
alert("Device not ready!");
return;
}
r.record({filename: "_doc/audio/"}, ()=> {
alert("Audio record success!");
}, (e)=> {
alert("Audio record failed: " + e.message);
});
},
stopRecord() {
this.r.stop();
},
},
components: {Mheader}
}
总结
以上是生活随笔为你收集整理的vue上传录音_vue用到H5+的录音功能 真机模拟的时候不能实现的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: bootstrap 空行不显示横杠_电脑
- 下一篇: vue 如何解析原生html,VUE渲染