jPlayer - 声音结束后确认框

时间:2012-09-14 11:21:36

标签: javascript jquery html jquery-plugins jplayer

声音结束后如何显示确认框?我使用jPlayer HTML5音频播放器播放声音。我有类似的东西:

$(document).ready(function() {
                $("#jquery_jplayer_1").jPlayer({
                    ready: function(event) {
                        $(this).jPlayer("setMedia", {
                            mp3: "http://mysite.com/sound.mp3"
                        });
                    },
                    swfPath: "http://www.jplayer.org/2.1.0/js",
                    supplied: "mp3"
                });             
            });

1 个答案:

答案 0 :(得分:3)

使用ended event

$(document).ready(function() {
    $("#jquery_jplayer_1").jPlayer({
        ready: function(event) {
            $(this).jPlayer("setMedia", {
                mp3: "http://mysite.com/sound.mp3"
            });
        },
        swfPath: "http://www.jplayer.org/2.1.0/js",
        supplied: "mp3",
        ended: function() {
            confirm('The sound ended?');
        }
    });             
});