I am using this method to load audio onto the page: https://blog.appery.io/2015/10/how-to...
and then using on page show event to trigger javascript and play the audio like so...
PlayTrack("sounds/theme.mp3");
This works and when i first open the app the audio is playing but if i navigate to another page and then come back to the first page the audio does not play on page load again - i see in the source the audio is not loaded. I am guessing that the js file method of loading the audio does not happen because the dom is not refreshed. So that js file needs to be modified not to use onload... wish i knew how to do that.. the contents of the js file are below...
var onLoad = function() {
var audioText = 'source src="https://sounds/theme.mp3"source/source/source';
var audio = jQuery(audioText);
jQuery("body").append(audio);
console.log("load");
};
jQuery(window).bind("load", onLoad);
// Play function
function PlayTrack(src) {
var au = jQuery("#yourAudio");
au.attr("src", src);
if (au[0] && au[0].play) au[0].play();
}
// Stop playing function
function StopPlayTrack() {
var au = jQuery("#yourAudio");
if (au[0] && au[0].play) au[0].pause();
}