问题
i have a question about jplayer.
this is my code:
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "Alin",
artist: "song",
mp3: "utl"
});
},
solution: 'html, flash',
cssSelectorAncestor: "#jp_container_1",
swfPath: "/res/vendor/jPlayer/dist/jplayer/",
supplied: "mp3",
});
$("#jquery_jplayer_1").bind($.jPlayer.event.seeking, function(e){
if($(".jp-title span").length <= 0){
$(".jp-title").prepend('<span><i class="fa fa-refresh fa-spin"></i></span>');
}
});
$("#jquery_jplayer_1").bind($.jPlayer.event.seeked, function(e){
$(".jp-title span").remove();
});
$("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, function(e) {
if (this.value === 0 ){
alert(1);
}
});
I want to show "Buffering" text if the playing music paused due slow internet. Actually i want to catch event when a playing audio is being paused for short while for buffering and then automatically play again when enough data buffered.
like this:

thanks
回答1:
$("#jquery_jplayer_1").bind($.jPlayer.event.progress, function (event){
// If media loading is complete
if (event.jPlayer.status.seekPercent === 100){
$(".jp-title .jp-title-loading").remove();
// Otherwise, if media is still loading
} else {
if($(".jp-title .jp-title-loading").length == 0){
$(".jp-title").prepend('<div class="jp-title-loading">Loading...</div>');
}
}
});
来源:https://stackoverflow.com/questions/30123390/jplayer-how-to-display-buffering-text