diff --git a/src/Util.js b/src/Util.js index 5eaecca..c65936d 100644 --- a/src/Util.js +++ b/src/Util.js @@ -32,7 +32,7 @@ Pizzicato.Util = { }, isOscillator: function(audioNode) { - return (audioNode && audioNode.toString() === "[object OscillatorNode]"); + return (audioNode && (audioNode.toString() === "[object OscillatorNode]" || audioNode.toString() === "[object WebKitOscillatorNode]")); }, isAudioBufferSourceNode: function(audioNode) { diff --git a/tests/Sound.test.js b/tests/Sound.test.js index 931ea64..c96ca21 100644 --- a/tests/Sound.test.js +++ b/tests/Sound.test.js @@ -5,7 +5,7 @@ describe('Sound', function() { it('should create by default a sinewave sound with 440 frequency', function() { var sound = new Pizzicato.Sound(); - expect(toString.call(sound.getSourceNode())).toBe('[object OscillatorNode]'); + expect(['[object OscillatorNode]', '[object WebKitOscillatorNode]']).toContain(toString.call(sound.getSourceNode())); expect(sound.getSourceNode().frequency.value).toBe(440); expect(sound.getSourceNode().type).toBe('sine'); }); @@ -79,7 +79,7 @@ describe('Sound', function() { it('should create an oscillator node', function() { var sound = new Pizzicato.Sound({ source: 'wave' }); - expect(toString.call(sound.getSourceNode())).toBe('[object OscillatorNode]'); + expect(['[object OscillatorNode]', '[object WebKitOscillatorNode]']).toContain(toString.call(sound.getSourceNode())); }); it('should execute callback function', function(done) {