jplayer ready event with playlist addon

孤街浪徒 提交于 2019-12-11 06:00:01

问题


Further to my previous post about when/where to dynamically add items to a playlist, it appears that the jPlayer ready event handler function is not available when the Playlist add-on is used, as can be seen by a simple example:

$(function () {
        var MyPlayList = new jPlayerPlaylist({
            jPlayer: "#jquery_jplayer_1",
            cssSelectorAncestor: "#jp_container_1"
        }, [], {
            smoothPlayBar: true,
            supplied: "mp3"
        });
        $("#jquery_jplayer_1").jPlayer({
            ready: function () {
                alert('here');
             }
        });

Whether this is because the event is not raised or because the jPlayer object is 'wrapped' by the PlayList is not clear, but either way it seems like a fairly fundamental restriction if this is indeed the case and there is no other way of achieving the same.


回答1:


You could try this :

    $("#jplayer_id").bind($.jPlayer.event.loadeddata, function(event) { 
        // do stuff
    });



回答2:


Actually, $.jPlayer.event.ready it is more appropriate.

$("#jplayer_id").bind($.jPlayer.event.ready, function(event) { 
        // do stuff
});


来源:https://stackoverflow.com/questions/19444278/jplayer-ready-event-with-playlist-addon

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