3
에 작품을 디코딩하지 않습니다. 그러나 문제는 FireFox와 Chrome에서 기본적으로 지원해야하지만 FireFox 만 웹 오디오 API의 decodeAudioData를 사용하여 OPUS 샘플 스트림을 디코딩 할 수 있습니다. opus 파일을 브라우저로 드래그하면 Chrome에서 파일을 인식하고 재생합니다. 그래서 내가 여기서 뭔가 잘못되어 Chrome에서 오류가 발생할 수 있습니다. 웹 오디오 API : decodeAudioData 내가 현재 오푸스 패킷이 웹 오디오 API와 함께 작동하도록 노력하고있어 크롬
그럼 난 그냥 오푸스 파일을로드하고 디코딩하려고 http://awm.jp/~yoya/js/audio/meow.html 일부 샘플 코드를 사용했다. 다시 파이어 폭스, 크롬 않습니다. 그래서 누군가가 내 발견을 확인하거나 제가 여기서 잘못하고있는 것을 말해 줄 수 있는지 궁금합니다. 아래는 이전 링크의 수정 된 버전입니다. 감사!<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title> decodeAudioData sample </title>
</head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
//$(document).ready(function() {
var catMeowingBuffer = null;
window.AudioContext = window.AudioContext||window.webkitAudioContext;
var context = new AudioContext();
function onError(err) {
console.log("unable to decode");
}
function loadCatSound(url) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'arraybuffer';
// Decode asynchronously
request.onload = function() {
context.decodeAudioData(request.response, function(buffer) {
catMeowingBuffer = buffer;
var src = context.createBufferSource();
src.buffer = catMeowingBuffer
src.connect(context.destination);
src.start(0);
}, onError);
}
request.send();
}
loadCatSound("opus.opus");
function playCatSound() {
if (catMeowingBuffer !== null) {
var src = context.createBufferSource();
src.buffer = catMeowingBuffer
src.connect(context.destination);
src.start(0);
}
}
//});
</script>
<body>
<h1> decodeAudioData sample </h1>
<button onclick="playCatSound();"> playCatSound </button>
<hr>
<address></address>
</body> </html>
감사합니다, 그것은 눈치 점점 볼 좋아요. 내 질문에 언급 된 바와 같이 – rq4t
[여기]가 수정되었습니다처럼 (http://stackoverflow.com/questions/42901470/mediarecorder-api-simple-example-hello-world은)는 보이지만, 시간이 걸릴 것입니다 그것이 안정되기 전에. 3 년 후 마침내 chrome에서 webaudio를 제대로 사용할 수있게되었습니다. – JoeRocc