2017-04-27 4 views
0

이 최소한의 예는 오디오 후 사파리 충돌 필터 재생이 중지 : 바탕 화면 (버전 10.1)에웹 오디오 API : 사파리 (iOS 및 맥 OS) 충돌 채널 합병은 바이 쿼드에 연결하면

<script> 
var context = new (window.AudioContext || window.webkitAudioContext)(); 

function start() { 
    var source = context.createOscillator(); 
    var chanMerge = context.createChannelMerger(2); 
    var filter = context.createBiquadFilter(); 

    source.connect(chanMerge, 0, 0); 
    source.connect(chanMerge, 0, 1); 
    // Connecting the channel merger directly to 
    // the biquad filter seems to be the problem. 
    chanMerge.connect(filter); 
    filter.connect(context.destination); 

    source.start(0); 
    source.stop(2); // This triggers the crash. 
} 
</script> 
<p>Safari will crash on/before the end of the tone</p> 
<button onclick='start()'>Play then crash</button> 

, 그것은 생성 다음 오류 보고서 : https://gist.github.com/captbaritone/f27385b454ecdaf8174a921604524412

답변

1

일시적인 해결 방법을 찾았습니다. 합병과 바이 쿼드 필터 사이에 더미 노드를 삽입하는 것이 가능합니다. 따라서 다음 예제는 작동하는 것으로 보입니다.

<script> 
var context = new (window.AudioContext || window.webkitAudioContext)(); 

function start() { 
    var source = context.createOscillator(); 
    var chanMerge = context.createChannelMerger(2); 
    var filter = context.createBiquadFilter(); 
    var dummyAnalyser = context.createAnalyser(); 

    source.connect(chanMerge, 0, 0); 
    source.connect(chanMerge, 0, 1); 

    chanMerge.connect(dummyAnalyser); 

    // Introducing this indirection seems to resolve the issue. 
    dummyAnalyser.connect(filter); 
    filter.connect(context.destination); 

    source.start(0); 
    source.stop(2); // This triggers the crash. 
} 
</script> 
<p>Safari will crash on/before the end of the tone</p> 
<button onclick='start()'>Play then crash</button>