How can i make circle jPlayer autoplay?

Kochumon Mathew picture Kochumon Mathew · Oct 18, 2011 · Viewed 27.4k times · Source

Can anyone tell me how to make this autoplay?

$(document).ready(function(){
    var myCirclePlayer = new CirclePlayer("#jquery_jplayer_1",
    {
        m4a:"x.mp3",
        oga: "x.ogg"
    }, {
        cssSelectorAncestor: "#cp_container_1"
    });
});

Answer

Andy Rose picture Andy Rose · Oct 18, 2011

Try this (documentation here) after you have created your player:

$('#jquery_jplayer_1').jPlayer("play");

Alternatively instantiate the player like this:

  $(document).ready(function () {
      $("#jquery_jplayer_1").jPlayer({
         ready: function () {
             $(this).jPlayer("setMedia", {
                m4a:"x.mp3",
                oga: "x.ogg"
              }).jPlayer("play");
          },
          swfPath: "/scripts/Jplayer.swf",
          supplied: "m4a, oga"
      });
  });