Skip to content

Commit

Permalink
Use webkitAudioContext on Safari
Browse files Browse the repository at this point in the history
This incorporates mudcube/MIDI.js#194 into the
MIDI.js library included in our source tree.
  • Loading branch information
gagern authored and montaga committed May 30, 2018
1 parent 975d1fd commit 06d3dd3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/midi/MIDI.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ MIDI.Player = MIDI.Player || {};
api = hash.substr(1);
} else if (supports.webmidi) {
api = 'webmidi';
} else if (window.AudioContext) { // Chrome
} else if (window.AudioContext || window.webkitAudioContext) {
api = 'webaudio';
} else if (window.Audio) { // Firefox
} else if (window.Audio) {
api = 'audiotag';
}

Expand Down Expand Up @@ -995,7 +995,7 @@ var stopAudio = function() {

(function(root) { 'use strict';

window.AudioContext && (function() {
(window.AudioContext || window.webkitAudioContext) && (function() {
var audioContext = null; // new AudioContext();
var useStreamingBuffer = false; // !!audioContext.createMediaElementSource;
var midi = root.WebAudio = {api: 'webaudio'};
Expand Down Expand Up @@ -1385,9 +1385,9 @@ var stopAudio = function() {
midi.connect = function(opts) {
root.setDefaultPlugin(midi);
var errFunction = function(err) { // well at least we tried!
if (window.AudioContext) { // Chrome
if (window.AudioContext || window.webkitAudioContext) {
opts.api = 'webaudio';
} else if (window.Audio) { // Firefox
} else if (window.Audio) {
opts.api = 'audiotag';
} else { // no support
return;
Expand Down

0 comments on commit 06d3dd3

Please sign in to comment.