I am writing an extension for Firefox Mobile (Fennec) which should play a sound. Using nsISound, i.e.
var sound = ios.newURI(pathToSoundFile, null, null);
var player = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
player.play(sound);
works fine on the Desktop version of Firefox, it but wouldn't produce any sound on FF Mobile. I also tried appending an audio element to the website,
var audioElement = win.content.document.createElement('audio');
audioElement.setAttribute('id','audio_test');
audioElement.setAttribute('src',pathToSoundFile);
win.content.document.body.appendChild(audioElement);
win.content.document.getElementById('audio_test').play();
which works, but only if the website is stored locally on my computer (due to security restrictions, I assume).
I tested this on an Asus Transformer Tablet with Android 4.2. Any suggestions?