如何使用jPlayerPlaylist附加组件处理jPlayer中的歌曲删除事件

时间:2015-05-06 19:22:09

标签: jplayer

这是我的代码:

var myPlaylist = new jPlayerPlaylist({
        jPlayer: "#jquery_jplayer_1",
        cssSelectorAncestor: "#jp_container_1"
    }, [
        {
            title:"Right Now(Na Na Na)",
            artist:"akon",
            mp3: "http://7xiaao.com1.z0.glb.clouddn.com/Akon - Right Now(Na Na Na).mp3"
            //oga: "/music/",
            //poster: "images/m0.jpg"
        }
    ], {
        playlistOptions: {
            enableRemoveControls: true,
            autoPlay: false
        },
        swfPath: "/res/plugin/jPlayer/dist/jplayer",
        supplied: "mp3",
        smoothPlayBar: true,
        useStateClassSkin: true,
        keyEnabled: true,
        audioFullScreen: false,
});

1 个答案:

答案 0 :(得分:2)

jPlayerPlaylist附加组件似乎无法提供处理歌曲删除事件的方法。

解决方法是自己处理x上的点击事件,例如:

$('.jp-playlist').on('click', '.jp-playlist-item-remove', function(){
    // Determine song index if necessary
    var index = $(this).parents('li').index('.jp-playlist li');

    // Retrieve song information, if necessary
    var song = myPlaylist.playlist[index];
});