How to repeat a song in jplayer circle

时光怂恿深爱的人放手 提交于 2019-12-12 04:21:30

问题


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:


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.



来源:https://stackoverflow.com/questions/12457655/how-to-repeat-a-song-in-jplayer-circle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!