I am using javascript to play .m4a audio files in a web application built on Rails. The audio plays well on computer. However, on Mobile browsers it does not. How do I go about solving this issue ? Is it because I am using .m4a ? Thanks !!
Only the app/views/people/new.html.erb and app/views/show.html.erb are concerned.
Here is app/views/people/new.html.erb
<div class="row">
<div class= "columns large-6">
<%= image_tag("trump.gif", size: "800x800", :id => "image0") %>
<%= audio_tag("welcome.m4a", autoplay: true, controls: false) %>
</div>
<div class="columns large-6">
<br>
<h3 class="gold">
<center>WANT TO KNOW WHAT TRUMP THINKS OF YOU?</center></h3>
<%= render 'form' %>
</div>
</div>
<div class="centerImg">
</div>
<script>
setTimeout(
function(){
$('#image0').attr( "src" , "<%= image_path "trump_final.png", :id => "image0" %>" );
// Play audio
//document.getElementById("staticImg").src = "trump.png"
//nameFunction(); should be called in syncronisation with (or at the end of audio1 playing)
// Sixth setTimeout
//nameFunction(); should be called in syncronisation with (or at the end of audio1 playing)
// Sixth setTimeout
//nameFunction(); should be called in syncronisation with (or at the end of audio1 playing)
// Sixth setTimeout
}, 2500);
</script>