I have this code:
var me = {
PreloadImage: function(src) {
var e = new Image();
e.src = src;
},
CreateAudio : function(src) {
var c = new Audio(src);
c.play();
}
}
I have a problem with new Audio()
, as JSLint
in Brackets says that Audio
has not been defined, but it doesn't say the same for Image
:
Sometimes I have to do things like window.console.log
instead of console.log
because console.log
was not defined, but if that's the case, what do I have to add before Audio
and Image
?
Instead of var c = new Audio(src);
use var c = document.createElement('audio'); c.src=src; c.play();