(e)
| 21 | audioContext = window.AudioContext || window.webkitAudioContext; |
| 22 | ctx = new audioContext(); |
| 23 | var fixAudioContext = function (e) { |
| 24 | console.log("fix"); |
| 25 | |
| 26 | // Create empty buffer |
| 27 | var buffer = ctx.createBuffer(1, 1, 22050); |
| 28 | var source = ctx.createBufferSource(); |
| 29 | source.buffer = buffer; |
| 30 | // Connect to output (speakers) |
| 31 | source.connect(ctx.destination); |
| 32 | // Play sound |
| 33 | if (source.start) { |
| 34 | source.start(0); |
| 35 | } else if (source.play) { |
| 36 | source.play(0); |
| 37 | } else if (source.noteOn) { |
| 38 | source.noteOn(0); |
| 39 | } |
| 40 | |
| 41 | // Remove events |
| 42 | document.removeEventListener('touchstart', fixAudioContext); |
| 43 | document.removeEventListener('touchend', fixAudioContext); |
| 44 | document.removeEventListener('mousedown', fixAudioContext); |
| 45 | }; |
| 46 | // iOS 6-8 |
| 47 | document.addEventListener('touchstart', fixAudioContext); |
| 48 | // iOS 9 |
nothing calls this directly
no outgoing calls
no test coverage detected