I tried like by adding headers inside jPlayer, its not working
const httpHeader = { 'authorization' : '123445'};
if (audioUrl) {
$(this).jPlayer('setMedia', {
mp3: audioUrl,
duration: parseInt(duration, 10),
headers : new Headers(httpHeader)
});
}
Seems like the
setMediamethod does not have a headers property, so this code will not work as-is.To set the headers for a jPlayer instance, you'll need to use the
jPlayermethod to set the headers for the player as a whole, rather than setting them for a specific media file. To do this, you can use theoptionmethod to set the headers property for the player, like this:This will set the headers for the player instance, and they will be used for all media files that are loaded by the players.