如何在jplayer圈中重复一首歌

时间:2012-09-17 10:44:37

标签: jquery html5 jplayer

如何在jplayer圈中重复一首歌?我使用以下代码进行自动播放。我也想实施重复。我试图添加一些选项,如repeat:,但它对我不起作用。

<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 个答案:

答案 0 :(得分:1)

此代码工作正常。自动播放正在进行,歌曲正在重复。

$("#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");
    }       
});

请注意,我正在使用循环而是重复。