参考文档:
1.https://github.com/yxl/opencore-amr-js (将amr文件转为wav格式的编解码项目)
因为项目需要,要将amr的base46格式的音频文件在IOS,android微信内置浏览器播放。项目中使用的第三方IM为融云,经过调研发现,使用融云js播放语音的方式,可以在IOS上播放,但是在Android上无法播放,而且h5的audio组件,不支持amr格式的音频文件。
最后得出的结论,IOS上的audio支持amr格式播放,android上audio组件不支持amr格式播放,包括使用融云js播放语音的方式,使用的也是audio组件。
想到的方案是,将amr的base64文件进行格式转换,转换为mp3,wav等audio支持的格式,然后进行播放,没有找到很好的资源。
经过领导的一句话,尝试性的找融云客服咨询了一下,看看有没有相关的项目,客服给了opencore-amr-js项目,是将amr格式的文件转换为wav格式的音频文件,进行播放。
将项目发布到测试环境,在微信内置浏览器跑了一下,得到的答案是,android可以正常播放,但是IOS无法播放;其中有一个对象,在IOS环境中,好像是找不到,运行就报错。
于是,综合了一下,得到了最终的解决方案,
IOS使用融云js进行语音播放,Android使用opencore-amr-js进行语音播放;播放语音时,判断机器为Android还是IOS,来选择播放方式。
在将opencore-amr-js项目往自己项目迁移的过程中,发现,融云js中使用的Libamr-2.2.5.min.js 文件,就是opencore-amr-js项目中的amrnb.js文件,也就是说,融云js也是在 opencore-amr-js项目的基础上开发的,而且改动也非常小,Android中需要使用的方法,都没有发生变动,感觉还是挺开心的,因为amrnb.js文件有474kb,太大了,如果在加上融云js的Libamr-2.2.5.min.js 文件,整个聊天室,得有1兆多了,加载时间太长了。
下面,将Android播放语音的代码放在下面:
demo下载地址,demo在项目的js目录下面。
Test decoder
Decode amr file and play
Select a local file and play:
Encode audio to amr file and play
Select a local file to encode and play:
base64测试
Amr to wav
Select a local file, convert and play:
wav file content:
// var u = navigator.userAgent;
// var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
// var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
// alert('是否是Android:'+isAndroid);
// alert('是否是iOS:'+isiOS);
function E(selector) {
return document.querySelector(selector);
}
E('#test > button').onclick = function () {
fetchAndReadBlob('yuan.amr', function (amr) {
fetchAndReadBlob('yuan.wav', function (expected) {
var actual = AMR.toWAV(amr);
if (actual == null) {
alert('Failed to decode amr file.');
return;
}
if (actual.length != expected.length) {
alert('The converted wav file has different size.');
return;
}
for (var i = 0; i < actual.length; i++) {
if (actual[i] != expected[i]) {
alert('The converted wav file has different content.');
return;
}
}
alert('Succeeded!');
});
});
};
E('#sample-amr > button').onclick = function () {
fetchBlob(E('#sample-amr > a').href, function (blob) {
playAmrBlob(blob);
});
};
E('#amr-file').onchange = function () {
playAmrBlob(this.files[0]);
};
E('#amr-to-wav > button').onclick = function () {
fetchBlob(E('#amr-to-wav > a').href, function (blob) {
convertAmrBlobToWav(blob);
});
};
E('#amr-to-wav-file').onchange = function () {
convertAmrBlobToWav(this.files[0]);
};
E('#sample-audio > button').onclick = function () {
fetchBlob(E('#sample-audio > a').href, function (blob) {
convertAudioBlobToAmr(blob);
});
};
E('#base64-audio > button').onclick = function () {
playAmrToWav('IyFBTVIKLEWGYIDYAbvFOH2GfsiOIegRLMIqLEkrjgtAHkTQivDmfVM1jaNZEngILE2GwAPEmHx5NDk7pUNLUfWYUsHoLEgkjgtMXPPQwhrzXi7BBeVsCTl8LCwkwAeF+DQZtU6aHy/oi85xm48+LEQZTg8IfgSxFs8MTWkmTJnCiVeQLAmWQA8DcwJqRyWK6D1JXNiGT1/kLCCtjhwg/i4HQxYBTh/FyL0c4PKGLEOUnB8ECWzBtivj/o0uCKBOSVwaLERviBwjOO1SQyDHHShqp6v5ntQ6LIK0jpaN20m16Ebxbex+FST/0L6cLESbnFiime8ELtBDikj7R/v6kpIGLJAYHB7i/IW3MtgZjH8HkdlbX+rQLENADj2QDXL1/KDsHpJRFQkItcEKLJA/slqjGeHpl6LdmIvkg+s3mzP6LGgYHB9gmUS7M7dqXkMDBu1gS3xCLE8Rhw5pGcJiYMXkGiFCKV12SAZSLEwYsh+gnLQ+jtRY/HnRKOJ9ze1kLGi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JALEy2Yh/XhmYCiVCLlzajAfEUWMguLEj3+h7jxmylCaVx37i3CWhpKWGILHErYh+hLwpIAHKG/QvnEdrODw6sLE5vsB8BHX9NB25jtw6yoWe/UuZMLEybQh6IrFm8zIPTe21TSd/RFaRoLEJvJhwgmctbkYBzLxzCI6iy0zL8LJBvjh4A+iT5BpUAXCPIgfPM/IoSLEkXrBwpm0brz3YZ5x2WjOtfJk1ILExHsh4JWJcFQhJ3G41WLeLxbOKELE8qvA8BFAh7Ayu/n3/QC3K6RziALGKjUBaQuYJNIf5SNlefkelZXdHKLEy0vBtJmTNtYwes7vyXUdPSa1IILClTUBwgSGp6STlsv9t2gH+kDWbALB4PvB0gABKm+hImnwV8APqdZESqLB4IvBwiYBAhMgCdOI3iAuM0M/bcLCnCvB4QkfzIOj5Yftvqne8ThXnaLBsyTh4AUxcAN1m1NHPfErnshny2LDCBjgtRngH0Uyp4vUqxCedYHn90LCgMtBhiCgXGoodefNWyYaHqE1/GLFHvwBxs1jRSisWI+Vp6yeSdnGcuLGLBNB6SAOpfVpFSl0N7MXVJmqayLGPvjB6wCd4Q9vtkrtWPMiiRFjsCLGPvOB4Qg3veV9o4e2WWCbLSuk8ELGOECB6KEKtFRBGWUxK3LevJNWNsLDj1Qg8DHsdbgDDcuKsSBt3JWOLKLGV4qBbDB43Kki7adLuXgfkNHV9gLCr1iB4BRtTwEyKynSE0RzQ3s35WLGBvnBaBjyYapz557a1MCOHUmyCYLGD1dBpADZckjEm83UZiGeWnvJZ4LFJvjh4D3MIUo6KETiRNJunrai7YLCz35g0gTwoylAWad+JWYfAq4NZcLBd4nB4J9jShLvlUXxQHARomefucLFF4QB4MOzYBfitFH8zyWcHoYidOLCyunA0kJsYb5+X82pWrMOxfPU8MLCrgThwhJtS4f/4l/gGyAeN08Xlo');
// var buffer = AMR.toWAV(result);
//// E('pre').textContent = toHex(buffer);
// var url = URL.createObjectURL(new Blob([buffer], {type: 'audio/wav'}));
// // Play wav buffer
// var audio = new Audio(url);
// audio.onloadedmetadata = audio.onerror = function () {
// URL.revokeObjectURL(url);
// };
// audio.play();
// playAmrBlob(E('#base64-input').value);
};
E('#base64-audio2 > button').onclick = function () {
playAmrToWav('IyFBTVIKLEWGYIDYAbvFOH2GfsiOIegRLMIqLEkrjgtAHkTQivDmfVM1jaNZEngILE2GwAPEmHx5NDk7pUNLUfWYUsHoLEgkjgtMXPPQwhrzXi7BBeVsCTl8LCwkwAeF+DQZtU6aHy/oi85xm48+LEQZTg8IfgSxFs8MTWkmTJnCiVeQLAmWQA8DcwJqRyWK6D1JXNiGT1/kLCCtjhwg/i4HQxYBTh/FyL0c4PKGLEOUnB8ECWzBtivj/o0uCKBOSVwaLERviBwjOO1SQyDHHShqp6v5ntQ6LIK0jpaN20m16Ebxbex+FST/0L6cLESbnFiime8ELtBDikj7R/v6kpIGLJAYHB7i/IW3MtgZjH8HkdlbX+rQLENADj2QDXL1/KDsHpJRFQkItcEKLJA/slqjGeHpl6LdmIvkg+s3mzP6LGgYHB9gmUS7M7dqXkMDBu1gS3xCLE8Rhw5pGcJiYMXkGiFCKV12SAZSLEwYsh+gnLQ+jtRY/HnRKOJ9ze1kLGiksh/A3DJFpp97NdhcYOKEjY5wLEzDnJdhDXHBDiasPfK6kXn+4t5mLE7bjh9gmT5rYfVsrppPiaj1HjgMLE1TnB9APIbLx4jNHneWgW2iXYYqLE5vjhfiHD5ogLu4T3Qa1UbBahXaLEBHsh6D2gTTLIciRh0Tpc+iVlQILEXtmh8COJcs4kOVfNmoU5JsVakWLEPtnBygeMf3F/mGHbA4xUxe72hsLCGWTh9CmefiloFgDeKuKaG3U4vkLEQknB4Jmfbed4B0/leEBU/3kXvOLEJyKBaNmWa/9pZULJ81ybNlqQb6LEgkjh8gaDKMxnuUHlamQX/UemkgLGWM6DzrvLaw9ebQvsl/gdtq1JVWLCVtgjxUVJO9VBapXB2CoWXvVa/8LDnZJSyf4Znt7JhPhFcGNQkWclhWLEf8SrVegZylvp9g/P9iEfJEy2sMLFP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s+pvJALEy2Yh/XhmYCiVCLlzajAfEUWMguLEj3+h7jxmylCaVx37i3CWhpKWGILHErYh+hLwpIAHKG/QvnEdrODw6sLE5vsB8BHX9NB25jtw6yoWe/UuZMLEybQh6IrFm8zIPTe21TSd/RFaRoLEJvJhwgmctbkYBzLxzCI6iy0zL8LJBvjh4A+iT5BpUAXCPIgfPM/IoSLEkXrBwpm0brz3YZ5x2WjOtfJk1ILExHsh4JWJcFQhJ3G41WLeLxbOKELE8qvA8BFAh7Ayu/n3/QC3K6RziALGKjUBaQuYJNIf5SNlefkelZXdHKLEy0vBtJmTNtYwes7vyXUdPSa1IILClTUBwgSGp6STlsv9t2gH+kDWbALB4PvB0gABKm+hImnwV8APqdZESqLB4IvBwiYBAhMgCdOI3iAuM0M/bcLCnCvB4QkfzIOj5Yftvqne8ThXnaLBsyTh4AUxcAN1m1NHPfErnshny2LDCBjgtRngH0Uyp4vUqxCedYHn90LCgMtBhiCgXGoodefNWyYaHqE1/GLFHvwBxs1jRSisWI+Vp6yeSdnGcuLGLBNB6SAOpfVpFSl0N7MXVJmqayLGPvjB6wCd4Q9vtkrtWPMiiRFjsCLGPvOB4Qg3veV9o4e2WWCbLSuk8ELGOECB6KEKtFRBGWUxK3LevJNWNsLDj1Qg8DHsdbgDDcuKsSBt3JWOLKLGV4qBbDB43Kki7adLuXgfkNHV9gLCr1iB4BRtTwEyKynSE0RzQ3s35WLGBvnBaBjyYapz557a1MCOHUmyCYLGD1dBpADZckjEm83UZiGeWnvJZ4LFJvjh4D3MIUo6KETiRNJunrai7YLCz35g0gTwoylAWad+JWYfAq4NZcLBd4nB4J9jShLvlUXxQHARomefucLFF4QB4MOzYBfitFH8zyWcHoYidOLCyunA0kJsYb5+X82pWrMOxfPU8MLCrgThwhJtS4f/4l/gGyAeN08Xlo');
};
E('#base64-audio4 > button').onclick = function () {
playAmrToWav('IyFBTVIKLEWGYIDYAbvFOH2GfsiOIegRLMIqLEkrjgtAHkTQivDmfVM1jaNZEngILE2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JBvjh4A+iT5BpUAXCPIgfPM/IoSLEkXrBwpm0brz3YZ5x2WjOtfJk1ILExHsh4JWJcFQhJ3G41WLeLxbOKELE8qvA8BFAh7Ayu/n3/QC3K6RziALGKjUBaQuYJNIf5SNlefkelZXdHKLEy0vBtJmTNtYwes7vyXUdPSa1IILClTUBwgSGp6STlsv9t2gH+kDWbALB4PvB0gABKm+hImnwV8APqdZESqLB4IvBwiYBAhMgCdOI3iAuM0M/bcLCnCvB4QkfzIOj5Yftvqne8ThXnaLBsyTh4AUxcAN1m1NHPfErnshny2LDCBjgtRngH0Uyp4vUqxCedYHn90LCgMtBhiCgXGoodefNWyYaHqE1/GLFHvwBxs1jRSisWI+Vp6yeSdnGcuLGLBNB6SAOpfVpFSl0N7MXVJmqayLGPvjB6wCd4Q9vtkrtWPMiiRFjsCLGPvOB4Qg3veV9o4e2WWCbLSuk8ELGOECB6KEKtFRBGWUxK3LevJNWNsLDj1Qg8DHsdbgDDcuKsSBt3JWOLKLGV4qBbDB43Kki7adLuXgfkNHV9gLCr1iB4BRtTwEyKynSE0RzQ3s35WLGBvnBaBjyYapz557a1MCOHUmyCYLGD1dBpADZckjEm83UZiGeWnvJZ4LFJvjh4D3MIUo6KETiRNJunrai7YLCz35g0gTwoylAWad+JWYfAq4NZcLBd4nB4J9jShLvlUXxQHARomefucLFF4QB4MOzYBfitFH8zyWcHoYidOLCyunA0kJsYb5+X82pWrMOxfPU8MLCrgThwhJtS4f/4l/gGyAeN08Xlo');
};
function playAmrToWav(amrStr) {
if (null != src) {
src.stop();
src = null;
}
var amrStr = window.atob(amrStr),
result = new Uint8Array(amrStr.length);
for (var i = 0, l = amrStr.length; i < l; i++) {
result[i] = amrStr.charCodeAt(i)
}
playAmrArray(result);
}
E('#audio-file').onchange = function () {
convertAudioBlobToAmr(this.files[0]);
};
var gAudioContext = new AudioContext();
function getAudioContext() {
if (!gAudioContext) {
gAudioContext = new AudioContext();
}
return gAudioContext;
}
function fetchBlob(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.responseType = 'blob';
xhr.onload = function () {
callback(this.response);
};
xhr.onerror = function () {
alert('Failed to fetch ' + url);
};
xhr.send();
}
function readBlob(blob, callback) {
var reader = new FileReader();
reader.onload = function (e) {
var data = new Uint8Array(e.target.result);
callback(data);
};
reader.readAsArrayBuffer(blob);
}
function fetchAndReadBlob(url, callback) {
fetchBlob(url, function (blob) {
readBlob(blob, callback);
});
}
function playAmrBlob(blob, callback) {
readBlob(blob, function (data) {
playAmrArray(data);
});
}
function convertAudioBlobToAmr(blob) {
readBlob(blob, function (data) {
var ctx = getAudioContext();
ctx.decodeAudioData(data.buffer, function (audioBuffer) {
var pcm;
if (audioBuffer.copyFromChannel) {
pcm = new Float32Array(audioBuffer.length);
audioBuffer.copyFromChannel(pcm, 0, 0);
} else {
pcm = audioBuffer.getChannelData(0);
}
var amr = AMR.encode(pcm, audioBuffer.sampleRate, 7);
playAmrArray(amr);
});
});
}
function playAmrArray(array) {
var samples = AMR.decode(array);
if (!samples) {
alert('Failed to decode!');
return;
}
playPcm(samples);
}
var src = null;
function playPcm(samples) {
var ctx = getAudioContext();
src = ctx.createBufferSource();
var buffer = ctx.createBuffer(1, samples.length, 8000);
if (buffer.copyToChannel) {
buffer.copyToChannel(samples, 0, 0)
} else {
var channelBuffer = buffer.getChannelData(0);
channelBuffer.set(samples);
}
src.buffer = buffer;
src.connect(ctx.destination);
src.start();
}
function convertAmrBlobToWav(blob) {
readBlob(blob, function (data) {
var buffer = AMR.toWAV(data);
E('pre').textContent = toHex(buffer);
var url = URL.createObjectURL(new Blob([buffer], {type: 'audio/x-wav'}));
// Play wav buffer
var audio = new Audio(url);
audio.onloadedmetadata = audio.onerror = function () {
URL.revokeObjectURL(url);
};
audio.play();
});
}
function toHex(buffer) {
var str = '';
for (var i = 0; i < buffer.length; i++) {
var s = buffer[i].toString(16);
if (s.length == 1) {
s = '0' + s;
}
str += s;
if (i % 16 == 15) { // print 16 bytes per line
str += '\n'
} else if (i % 2 == 1) { // add a space seperator every two bytes.
str += ' ';
}
}
return str;
}