Skip to content

Commit 3e651c8

Browse files
committed
Use webkitAudioContext on Safari
This incorporates mudcube/MIDI.js#194 into the MIDI.js library included in our source tree.
1 parent 583d672 commit 3e651c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/midi/MIDI.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ MIDI.Player = MIDI.Player || {};
309309
api = hash.substr(1);
310310
} else if (supports.webmidi) {
311311
api = 'webmidi';
312-
} else if (window.AudioContext) { // Chrome
312+
} else if (window.AudioContext || window.webkitAudioContext) {
313313
api = 'webaudio';
314-
} else if (window.Audio) { // Firefox
314+
} else if (window.Audio) {
315315
api = 'audiotag';
316316
}
317317

@@ -995,7 +995,7 @@ var stopAudio = function() {
995995

996996
(function(root) { 'use strict';
997997

998-
window.AudioContext && (function() {
998+
(window.AudioContext || window.webkitAudioContext) && (function() {
999999
var audioContext = null; // new AudioContext();
10001000
var useStreamingBuffer = false; // !!audioContext.createMediaElementSource;
10011001
var midi = root.WebAudio = {api: 'webaudio'};
@@ -1385,9 +1385,9 @@ var stopAudio = function() {
13851385
midi.connect = function(opts) {
13861386
root.setDefaultPlugin(midi);
13871387
var errFunction = function(err) { // well at least we tried!
1388-
if (window.AudioContext) { // Chrome
1388+
if (window.AudioContext || window.webkitAudioContext) {
13891389
opts.api = 'webaudio';
1390-
} else if (window.Audio) { // Firefox
1390+
} else if (window.Audio) {
13911391
opts.api = 'audiotag';
13921392
} else { // no support
13931393
return;

0 commit comments

Comments
 (0)