Skip to content

Commit

Permalink
QuickStart 源码中4空格换成tab
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyuecn committed Mar 9, 2020
1 parent 113f577 commit b80bd20
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions QuickStart.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,32 @@
rec=null;
wave=null;
recBlob=null;
var newRec=Recorder({
type:"mp3",sampleRate:16000,bitRate:16 //mp3格式,指定采样率hz、比特率kbps,其他参数使用默认配置;注意:是数字的参数必须提供数字,不要用字符串;需要使用的type类型,需提前把格式支持文件加载进来,比如使用wav格式需要提前加载wav.js编码引擎
,onProcess:function(buffers,powerLevel,bufferDuration,bufferSampleRate,newBufferIdx,asyncEnd){
//录音实时回调,大约1秒调用12次本回调
var newRec=Recorder({
type:"mp3",sampleRate:16000,bitRate:16 //mp3格式,指定采样率hz、比特率kbps,其他参数使用默认配置;注意:是数字的参数必须提供数字,不要用字符串;需要使用的type类型,需提前把格式支持文件加载进来,比如使用wav格式需要提前加载wav.js编码引擎
,onProcess:function(buffers,powerLevel,bufferDuration,bufferSampleRate,newBufferIdx,asyncEnd){
//录音实时回调,大约1秒调用12次本回调
document.querySelector(".recpowerx").style.width=powerLevel+"%";
document.querySelector(".recpowert").innerText=bufferDuration+" / "+powerLevel;

//可视化图形绘制
wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
}
});
}
});

createDelayDialog(); //我们可以选择性的弹一个对话框:为了防止移动端浏览器存在第三种情况:用户忽略,并且(或者国产系统UC系)浏览器没有任何回调,此处demo省略了弹窗的代码
newRec.open(function(){//打开麦克风授权获得相关资源
dialogCancel(); //如果开启了弹框,此处需要取消
createDelayDialog(); //我们可以选择性的弹一个对话框:为了防止移动端浏览器存在第三种情况:用户忽略,并且(或者国产系统UC系)浏览器没有任何回调,此处demo省略了弹窗的代码
newRec.open(function(){//打开麦克风授权获得相关资源
dialogCancel(); //如果开启了弹框,此处需要取消
rec=newRec;

//此处创建这些音频可视化图形绘制浏览器支持妥妥的
wave=Recorder.FrequencyHistogramView({elem:".recwave"});

reclog("已打开录音,可以点击录制开始录音了",2);
},function(msg,isUserNotAllow){//用户拒绝未授权或不支持
dialogCancel(); //如果开启了弹框,此处需要取消
reclog((isUserNotAllow?"UserNotAllow,":"")+"打开录音失败:"+msg,1);
});
},function(msg,isUserNotAllow){//用户拒绝未授权或不支持
dialogCancel(); //如果开启了弹框,此处需要取消
reclog((isUserNotAllow?"UserNotAllow,":"")+"打开录音失败:"+msg,1);
});

window.waitDialogClick=function(){
dialogCancel();
Expand Down Expand Up @@ -171,14 +171,14 @@
reclog("未打开录音",1);
return;
};
rec.stop(function(blob,duration){
console.log(blob,(window.URL||webkitURL).createObjectURL(blob),"时长:"+duration+"ms");
rec.stop(function(blob,duration){
console.log(blob,(window.URL||webkitURL).createObjectURL(blob),"时长:"+duration+"ms");
recBlob=blob;
reclog("已录制mp3:"+duration+"ms "+blob.size+"字节,可以点击播放、上传了",2);
},function(msg){
reclog("录音失败:"+msg,1);
});
},function(msg){
reclog("录音失败:"+msg,1);
});
};


Expand Down Expand Up @@ -337,7 +337,7 @@
body{
word-wrap: break-word;
background:#f5f5f5 center top no-repeat;
background-size: auto 680px;
background-size: auto 680px;
}
pre{
white-space:pre-wrap;
Expand Down

0 comments on commit b80bd20

Please sign in to comment.