Skip to content

Commit

Permalink
调整权限提醒
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyuecn committed Dec 7, 2018
1 parent c851101 commit c9833cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 65 deletions.
64 changes: 1 addition & 63 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,68 +37,6 @@
<script src="https://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>

<!-- begin 开始copy源码 -->
<div>
<div class="pd">
GitHub:<a href="https://github.com/xiangyuecn/Recorder">https://github.com/xiangyuecn/Recorder</a>
</div>
<div class="pd">
类型:
<label><input type="radio" name="type" value="mp3" checked>MP3</label>
<label><input type="radio" name="type" value="wav">WAV</label>
</div>
<div class="pd">
比特率:<input type="text" class="bit" value="16">(kbps mp3) (wav取值8、16)
</div>
<div class="pd">
采样率:<input type="text" class="sample" value="16000">(mp3标准值,wav任意)
</div>
<div class="pd">
<button onclick="recopen()">打开录音</button>
<button onclick="recclose()">关闭录音</button>
</div>
<div class="pd">
<button onclick="recstart()">录制</button>
<button onclick="recstop()">停止</button>

<button onclick="recpause()" style="margin-left:60px">暂停</button>
<button onclick="recresume()">继续</button>
</div>
<div class="pd recpower">
<div style="height:40px;width:300px;background:#999;position:relative;">
<div class="recpowerx" style="height:40px;background:#0B1;position:absolute;"></div>
<div class="recpowert" style="padding-left:50px; line-height:40px; position: relative;"></div>
</div>
</div>
<div class="pd">
<button onclick="recstop2()">批量编码</button>
<input type="text" class="bits" value="8 to 96 step 8">kbps(wav固定8、16),测试音质用的,除比特率外其他参数可调整
</div>

<hr>
<div class="reclog"></div>
<div class="recinfo"></div>
<audio class="recPlay"></audio>
</div>
<script type="text/template" class="tp_recinfo">
<hr/>
浏览器环境情况:
<pre>
AudioContext:{fn:!!window.AudioContext}
webkitAudioContext:{fn:!!window.webkitAudioContext}
mediaDevices:{fn:!!navigator.mediaDevices}
mediaDevices.getUserMedia:{fn:!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}
navigator.getUserMedia:{fn:!!navigator.getUserMedia}
navigator.webkitGetUserMedia:{fn:!!navigator.webkitGetUserMedia}

UA:{fn:navigator.userAgent}

Recorder库修改时间(有可能修改了忘改):{fn:RecorderLM}
本页面修改时间(有可能修改了忘改):{fn:PageLM}




</pre>
<div>
<hr>
注:录音时注意观察灰色区域是否有绿色音量跳动,没有绿色跳动说明Recorder没有获取到声音数据。如果测试发现mp3没有声音,可以试一下wav格式,如果wav格式有声音,说明内置lamejs mp3编码器有问题。如果都没有,下载下来播放看看有没有。下载下来也没有声音可以反馈一下。
Expand Down Expand Up @@ -281,7 +219,7 @@
,function(){
JsVal.value+="\n支持录音";
},function(e){
JsVal.value+="\n"+e.code||e.name||""
JsVal.value+="\n"+(e.name||e.message)
});
"wait..."</textarea>
<input type="button" value="执行js" onclick="cmdExec()">
Expand Down
4 changes: 2 additions & 2 deletions recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ RecorderFn.prototype={
True();
};
var f2=function(e){
var code=e.code||e.name||"";
var code=e.name||e.message||"";
console.error(e);
False(/Permission/i.test(code)?"用户拒绝了录音权限":"无法录音:"+code);
False(/Permission|Allow/i.test(code)?"用户拒绝了录音权限":"无法录音:"+code);
};
var pro=scope.getUserMedia({audio:true},f1,f2);
if(pro&&pro.then){
Expand Down

0 comments on commit c9833cf

Please sign in to comment.