title: "Autoplay" HTML5 audio player on mobile browsers
body: <p>I am creating a HTML5 music website for mobile users.The goal is to get it running completely in mobile browsers..<br><br>
  The issue is that when a user selects a track to play, they are taken to the "player" page.I then AJAX in a HTML5 audio element in with the autoplay attribute set to true. This works great on desktops, not so much on mobile.<br><br>
  The track is not playing though once this page is reached, and the user instead needs to explicitly click play from this player page in order for audio playback to start.
  Any ideas on how I can adjust my flow in order for audio playback to <strong>autoplay</strong> after loading the playing page?</p>
  
  <p><strong>Here's my HTML code:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /&gt;
  &lt;meta name="description" content=""&gt;
  &lt;meta name="author" content=""&gt;
  &lt;link rel="icon" href="../../favicon.ico"&gt;
  &lt;title&gt;Mobile Websites&lt;/title&gt;
  &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/responsive.css"&gt;
  &lt;link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,800,800italic,700italic' rel='stylesheet' type='text/css'&gt;
  &lt;script type='text/javascript' src='js/jquery.js'&gt;&lt;/script&gt;
  &lt;script type='text/javascript' src='js/amazingaudioplayer.js'&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div class="right-part"&gt;
    &lt;div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 bg-color"&gt;
      &lt;div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"&gt;
        &lt;div class="back"&gt;&lt;a href="index.html"&gt;back&lt;/a&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-lg-10 col-md-10 col-sm-10 col-xs-10"&gt;
        &lt;div class="col-lg-9 col-md-9 col-sm-9 col-xs-9"&gt;
          &lt;div class="song-name"&gt;Player&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"&gt;
          &lt;div class="playerr"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="bg"&gt;
   &lt;div class="container filter-main-div"&gt;
      &lt;div class="song-main-div row"&gt; 
        &lt;div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 player-div"&gt;
     &lt;!--  &lt;ul class="share-song"&gt;
      &lt;li&gt;&lt;a class="fav" href="#123"&gt;&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class="share" href="#123"&gt;share&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a class="rbt" href="#123"&gt;RBT&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;--&gt;
        &lt;div id="primary"&gt;
  
      &lt;div class="demo-slider"&gt;
  
      &lt;link rel="stylesheet" type="text/css" media="all" href="css/initaudioplayer.css" /&gt;
        &lt;div id="amazingaudioplayer-7" style="display:block;position:relative;width:320px;height:164px;margin:0px auto 0px;"&gt;&lt;div class="suffle"&gt;Suffle&lt;/div&gt;
          &lt;ul class="amazingaudioplayer-audios" style="display:none;"&gt;
            &lt;li data-artist="pinkzebra" data-title="In The Moment of Inspiration" data-album="AudioJungle" data-info="" data-image="images/diamon-img.png" data-duration="154"&gt;
              &lt;div class="amazingaudioplayer-source" data-src="audio/devesh.mp3" data-type="audio/mpeg" /&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;&lt;div class="play-fav"&gt;&lt;a class="fav" href="#123"&gt;sdfsdfsdfdsf&lt;/a&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
    &lt;script src="js/initaudioplayer.js"&gt;&lt;/script&gt; 
  &lt;/div&gt;
         &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  
  &lt;!-- Bootstrap core JavaScript
      ================================================== --&gt; 
  &lt;!-- Placed at the end of the document so the pages load faster --&gt; 
  &lt;script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>initaudioplayer.js :</strong></p>
  
  <pre><code>jQuery(document).ready(function(){
  
      var jsFolder = "images";
  
      jQuery("#amazingaudioplayer-7").amazingaudioplayer({
  
          jsfolder:jsFolder,
  
          volumeimagewidth:24,
  
          barbackgroundimage:"",
  
          imagewidth:100+'%',
  
          showtime:true,
  
          titleinbarwidth:80,
  
          showprogress:true,
  
          random:false,
  
          titleformat:"%TITLE%",
  
          height:164,
  
          prevnextimage:"prevnext-48-48-0.png",
  
          showinfo:true,
  
          imageheight:100+'%',
  
          skin:"MusicBox",
  
          loopimage:"repeat-img.png",
  
          loopimagewidth:33,
  
          volumebarheight:80,
  
          prevnextimageheight:40,
  
          infoformat:"By %ARTIST% %ALBUM%&lt;br /&gt;%INFO%",
  
          showstop:false,
  
          showvolumebar:true,
  
          width:320,
  
          showtitleinbar:false,
  
          showloop:true,
  
          volumeimage:"volume-24-24-1.png",
  
          playpauseimagewidth:75,
  
          loopimageheight:36,
  
          tracklistitemformat:"%ORDER%. %TITLE% %DURATION%",
  
          prevnextimagewidth:40,
  
          tracklistarrowimage:"tracklistarrow-16-16-0.png",
  
          playpauseimageheight:75,
  
          showbackgroundimage:false,
  
          progresswidthmode:"fixed",
  
          stopimage:"stop-48-48-0.png",
  
          showvolume:true,
  
          playpauseimage:"playpause-48-48-0.png",
  
          showprevnext:true,
  
          backgroundimage:"",
  
          volumebarpadding:8,
  
          progressheight:8,
  
          showtracklistbackgroundimage:false,
  
          progresswidth:296,
  
          showtitle:true,
  
          tracklistarrowimageheight:16,
  
          heightmode:"fixed",
  
          titleinbarformat:"%TITLE%",
  
          showtracklist:true,
  
          stopimageheight:48,
  
          volumeimageheight:24,
  
          stopimagewidth:48,
  
          tracklistbackgroundimage:"",
  
          showbarbackgroundimage:false,
  
          showimage:true,
  
          tracklistwidth:320,
  
          tracklistarrowimagewidth:16,
  
          timeformat:"%CURRENT% / %DURATION%",
  
          autoplay:true,
  
          loop:1,
  
          tracklistitem:10
  
      });
  
  });
  </code></pre>