jplayer如何显示“缓冲”文本 [英] jplayer how to display “buffering” text

查看:122
本文介绍了jplayer如何显示“缓冲”文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于jplayer的问题。

i have a question about jplayer.

这是我的代码:

$("#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.

像这样:

谢谢

推荐答案

$("#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>');
       }
    }
});

这篇关于jplayer如何显示“缓冲”文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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