/**
* 根据浏览器获取录音标签
* @param {录音媒体播放地址} src
*/
function getAudioDom(src) {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
if (
(userAgent.indexOf("Trident") > -1 && userAgent.indexOf("rv:11.0")) ||
(userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1)
) {
//如果为ie浏览器则显示embed
return (
'<embed class="embed" type="audio/wav" src="' +
src +
'" menu="true" loop="false" align="center" preload="auto" autostart="false">\
</embed>'
);
} else {
return (
'<audio controls="controls" src="' +
src +
'" type="audio/wav" id="record-audio" preload></audio>'
);
}
}
IE下音频样式
embed{
border:1px solid gray;
height: 40px;
width: 350px;
margin-left: 10px;
background-color:#F8F8F8;
}