I am implementing jquery jPlayer in my project and now everything is working perfect. However, Whenever i am clicking on play, Next, Prev, I can see a url hitting on my network console also i can see the same issue when song is automatically switched to next one. The url is my domain following by undefined parameter.
ex: https://thisisthedomain.com/undefined
my trigger function is
$(document).on("click",".playsong",function(){
var current = $(this).attr("data-current");
var current_title = $(this).attr("data-title");
jplayercall(track_inside,current,current_title);
});
function jplayercall(track_inside,current,current_title){
var jplayerId = "";
var jcontainer = "";
var jplayerId = "#jquery_jplayer_1";
var jcontainer = "#jp_container_1";
$("#audio_track").removeClass("hide");
$("#jquery_jplayer_1").jPlayer( "destroy" );
$("#jquery_jplayer_1").show();
$("#jp_container_1").show();
var autoplayOption = false;
var myPlaylist=new jPlayerPlaylist({
jPlayer: jplayerId,
cssSelectorAncestor: jcontainer
},track_inside,
{
playlistOptions: { autoPlay:true},
swfPath: "/player/js",
supplied: "oga,m4a, mp3",
wmode: "window",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true
});
if($("#audio_track .track-detail").length > 0){
$("#audio_track .track-detail").text(current_title);
}
setTimeout(function(){
myPlaylist.play(parseInt(current));
},150);
$("#jquery_jplayer_1").bind($.jPlayer.event.play, function (event){
console.log(event.jPlayer.status.media.title);
if($("#audio_track .track-detail").length > 0){
$("#audio_track .track-detail").text(event.jPlayer.status.media.title);
}
});
}
If I am commenting out myPlaylist.play(parseInt(current)); then this issue won't come, but then song won't play.