Reputation: 20895
I'm using the HTML5 web audio API, and I'm trying to dynamically determine which AudioContext constructor to use via
var constructor = AudioContext || webkitAudioContext;
var context = new constructor();
However, with this code, Safari quips:
ReferenceError: Can't find variable: AudioContext
For starters, I didn't even know that ReferenceError
s exist in javascript, since undefined variables by default take on the undefined
value. Safari's implementation of javascript apparently differs in big ways from that of Chrome, even though both use webkit engines ...
How do I determine which constructor to use without triggering this error?
Upvotes: 1
Views: 1571