JQuery jPlayer changes media does not work

I am trying to change a song to jQuery using the developer guide, I came up with this function:

<script type="text/javascript"> $(document).ready(function(){ $('.embedinfo').click(function() { $("#jquery_jplayer_1").jPlayer( "clearMedia" ); $("#jquery_jplayer_1").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { mp3:"/audio/<?php echo $audioarray[0]['audio']; ?>" }).jPlayer("<?php if(empty($auto)){ echo "pause"; } elseif($auto==1){ echo "play"; } ?>"); }, swfPath: "/js/Jplayer.swf", supplied: "mp3", wmode: "window", solution:"flash,html", volume:"1" }); }); 

});

The setMedia function is actually identical to the function that I use to initially configure the music (which really works), however this function to change the music from pressing does not work.

The clearMedia function works, just isnt there. Why doesn't it work?

+6
source share
1 answer

I found a solution

instead

 $("#jquery_jplayer_1").jPlayer( "clearMedia" ); 

which removes media use

 $("#jquery_jplayer_1").jPlayer( "destroy" ); 

which unscrews all instances of .jPlayer, allowing the media to be updated from scratch.

+6
source

Source: https://habr.com/ru/post/916138/


All Articles