jplayer multiple mp3 file links in one page

前端 未结 4 601
旧时难觅i
旧时难觅i 2021-01-16 00:15

I use jplayer in my page and when clicked a link I want to play the clicked one. However every time test1.mp3 is played. How can I solve it? The code is below:

the p

4条回答
  •  Happy的楠姐
    2021-01-16 01:01

    $('.reproducirContenedor').on('click',function(e){// click en el elento a reproduccopm
        e.preventDefault();
    
    
        jQuery("#jquery_jplayer_1").jPlayer({
            swfPath: "http://www.jplayer.org/latest/js/Jplayer.swf",
            supplied: "mp3",
            wmode: "window",
            preload:"auto",
            autoPlay: true,
            errorAlerts:false,
            warningAlerts:false
          });
       
        var url_destino=$(this).attr('data-demo');// obtengo el url y reproduzo la cancoon
    
        console.log("ffffd");
    
    
        jQuery("#jquery_jplayer_1").jPlayer("setMedia", {
            mp3:url_destino
          });
    
          jQuery("#jquery_jplayer_1").jPlayer("play");
        
            
    });
       
    

提交回复
热议问题