ここに問題を示すためのフィドルがあります。createMediaElementSource
基本的に、オブジェクトのメソッドが呼び出されるたびAudioContext
に、 audio 要素の出力が返された に再ルーティングされMediaElementAudioSourceNode
ます。これはすべて問題なく、仕様に従っています。ただし、出力をスピーカーに再接続しようとしても (の を使用destination
) AudioContext
、何も起こりません。
ここで明らかな何かが欠けていますか?たぶん、クロスドメインのオーディオファイルと関係がありますか? Google でこのトピックに関する情報を見つけることができず、仕様にそのメモが表示されませんでした。
フィドルのコードは次のとおりです。
var a = new Audio();
a.src = "http://webaudioapi.com/samples/audio-tag/chrono.mp3";
a.controls = true;
a.loop = true;
a.autoplay = true;
document.body.appendChild(a);
var ctx = new AudioContext();
// PROBLEM HERE
var shouldBreak = true;
var src;
if (shouldBreak) {
// this one stops playback
// it should redirect output from audio element to the MediaElementAudioSourceNode
// but src.connect(ctx.destination) does not fix it
src = ctx.createMediaElementSource(a);
src.connect(ctx.destination);
}