|
楼主 |
发表于 2018-5-8 14:33:36
|
显示全部楼层
<script type="text/javascript" src="/cordova.js"></script>
start <input type='button' onclick="start()"><br>
stop <input type='button' onclick="stop()"><br>
play<input type='button' id="url" onclick="play()"><br>
<script>
var Model = function() {
this.callParent();
this.mediaTimer;
this.mediaRec;
this.fileName;
this.timeLen;
this.operateType;
this.STORE_ID = "com.justep.demo.advice.audiodata";
this.openByDialog = false;
};
function start(){
alert('19');
var me = this;
// 根据系统时间产生文件名
this.fileName = "123.wav";
this.mediaRec = new Media(this.fileName,
function() {
},
function(err) {
alert('error');
}
);
// 开始录音
alert('1');
this.mediaRec.startRecord();
alert('2');
this.operateType = "record";
alert('12');
}
function stop(){
clearInterval(this.mediaTimer);
if (this.operateType == "record") {
// 停止录音
this.mediaRec.stopRecord();
alert('123456');
}
}
function play(){
this.mediaRec = new Media("123.wav",
function() {
},
function(err) {
alert('error');
}
);
// 播放音频
this.mediaRec.play();
alert('play');
}
</script>
模式4下,已经确认过有插件导入了,但是录音没有任何效果,按play的时候直接去到error方法 |
|