I have tried every solution i can think of and still can't get this to work. I am able to load and play mp3's or ogg's in every browser including the iPhone but the only remaining frontier is the iPad and the audio won't play. When I click on the song, it loads the code into the audio-player src but it doesn't play the song. Again, this works in every other HTML5 supported browser but the iPad doesn't play the file. If I paste the file path into the code, the song plays so I think it has to do with the load and play functions but I can't figure out how exactly.
Below is the appropriate code. Any help would be veeeery greatly appreciate. Thanks in advance.
HTML
<div id="song-title-display"></div>
<div id="song-title">
<ul class="list">
<li><a class="tracks selected" id="1_tracks" href="1" data-file="song1">Song1</a></li>
<li><a class="tracks" id="2_tracks" href="2" data-file="song2">Song2</a></li>
</ul>
</div>
<audio id="audio-player" name="audio-player">
<source id="source-file1" src="" type="audio/mpeg">
<source id="source-file2" src="" type="audio/ogg">
</audio>
JS
$("#song-title a").click(function() {
var name = $(this).html(),
filename = $(this).attr("data-file");
filename2 = "uploadedsongsfolder" + filename;
filename3 = "uploadedsongsfolder" + filename + ".mp3";
filename4 = "uploadedsongsfolder" + filename + ".ogg";
$('#song-title-display').html($(this).html());
clickedID=$(this).attr('href');
$('.tracks').removeClass('selected'); $('#'+clickedID+'_tracks').addClass('selected');
document.getElementById('source-file1').src = filename3;
document.getElementById('source-file2').src = filename4;
$("#audio-player")[0].load();
$("#audio-player")[0].play();
return false;