He元素

Don't be shy just try!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

引用js:jquery.jplayer.min.js;

body里面必须有这个:

<div id="jplayer"></div>

 

jplayer停止方法

function jpclear() {
$("#jplayer").jPlayer("clearMedia");
$("#jplayer").jPlayer("stop");
$("#jplayer").unbind($.jPlayer.event.ended);
$("#jplayer").unbind($.jPlayer.event.progress);
}

jplayer开始方法

function jpstart(){
$("#jplayer").jPlayer({
swfPath: "js",
wmode: "window",
supplied: "mp3",
preload: "none",
volume: "1"
});
$("#jplayer").jPlayer("setMedia", {
mp3: mp3
}).jPlayer("play");
}

点击试听

  //试听
  $(".ext_btn_listen").live("click",function() {        $(this).parent().parent().siblings().find('.ext_btn_listen').val('试听');
    var mp3 = $(this).attr('dvideo');
 // var mp3='20150901/55e50a7848625.mp3';
    if(!mp3){alert("请上传音频");}
    else
    {
        
         mp3 = "../uploads/" + mp3;   
        if($(this).val()=='试听'){
            $(this).val('停止');
            $("#jplayer").jPlayer({
            swfPath: "js",
            wmode: "window",
            supplied: "mp3",
            preload: "none",
            volume: "1"
          });
            $("#jplayer").jPlayer("setMedia", {
                mp3: mp3
            }).jPlayer("play");
            
        }else{
            $(this).val('试听');
            jpclear();
        }
        
    }
  });

 

posted on 2015-09-22 10:11  He元素  阅读(1143)  评论(0编辑  收藏  举报