How to repeat a song in jplayer circle

2019-09-08 20:34发布

How to repeat a song in jplayer circle? I am using the below code for autoplay. I want to implement repeat also. I have tried to add some option like repeat:, but it didn't work for me.

<script type="text/javascript">
    $(document).ready(function(){

        /*
         * Instance CirclePlayer inside jQuery doc ready
         *
         * CirclePlayer(jPlayerSelector, media, options)
         *   jPlayerSelector: String - The css selector of the jPlayer div.
         *   media: Object - The media object used in jPlayer("setMedia",media).
         *   options: Object - The jPlayer options.
         *
         * Multiple instances must set the cssSelectorAncestor in the jPlayer options. Defaults to "#cp_container_1" in CirclePlayer.
         */

        var myCirclePlayer = new CirclePlayer("#jquery_jplayer_1",
        {
            mp3: "http://gokuldham.siyatechnologies.com/Images/ShreejiDhun.mp3",
            oga: "http://gokuldham.siyatechnologies.com/Images/ShreejiDhun.ogg"
        }, {
            cssSelectorAncestor: "#cp_container_1",
            canplay: function() {
            $("#jquery_jplayer_1").jPlayer("play");
            }

        });
    });
</script>

1条回答
▲ chillily
2楼-- · 2019-09-08 20:58

This code works fine. Autoplay is working and song is repeating.

$("#jquery_jplayer_1").jPlayer({
    ready: function (event) {
        $(this).jPlayer("setMedia", {
            m4a:"http://www.jplayer.org/audio/m4a/TSP-01-Cro_magnon_man.m4a",
            oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
        });
    },
    swfPath: "js",
    supplied: "m4a, oga",
    wmode: "window",
    loop: true,
    canplay: function() {
       $("#jquery_jplayer_1").jPlayer("play");
    }       
});

Note that I'm using loop instead repeat.

查看更多
登录 后发表回答