使jPlayer停留在轨道尽头 [英] Make jPlayer stay at end of track

查看:75
本文介绍了使jPlayer停留在轨道尽头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标准jPlayer演示所示,曲目结束时,播放器会将时间重置为零.有什么办法让它停留在曲目的尽头吗?

As demonstrated in the standard jPlayer demo, when the track ends, the player resets time to zero. Is there any way to make it stay at the end of the track?

推荐答案

结合使用 ended()事件和 playHead 方法,将播放头保持在结束时结束.

Use the ended() event in conjunction with the playHead method to keep the play head at the end when it ends.

修改示例,这是我得到的:

Modifying the example, here's what I got:

$(document).ready(function() {

    $("#jquery_jplayer_1").jPlayer({
        ready: function(event) {
            $(this).jPlayer("setMedia", {
                mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
                oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
            });
        },
        swfPath: "http://www.jplayer.org/2.1.0/js",
        supplied: "mp3, oga",
        ended : function(){
            console.log("ended");
            $(this).jPlayer("playHead",100);
        }
    });
});                                      
​

JSFiddle:: http://jsfiddle.net/wjsKa/2/
参考: http://jplayer.org/latest/developer-guide/

这篇关于使jPlayer停留在轨道尽头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆