I am writing a Chrome Web Application in which I am dynamically creating <audio> tags through Javascript. Javascript is pulling the names from an object literal. When I run the files locally through Chrome, it works just fine. Once I load them onto a server, they stop working. The dynamic images work fine, so I'm curious as to why the audio does not. What could possibly be wrong? Here is my javascript code:
var IG = {
0: { 'sound': 'chair.ogg', 'link': 'images/chair.png', 'name': 'Chair'}
};
var audio1 = '<audio controls><source src="audio"';
var audio2 = '" type="audio/ogg">Your browser does not support the audio element. Please upgrade your browser.</audio>';
document.getElementById('quiz').innerHTML += audio1 + IG[order].sound + audio2;
UPDATE: If I play the sound file directly, it works fine. Eg: www.site.com/audio/chair.ogg. I have also tried using mp3 files with the same result.