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)
});
}
1条答案
按热度按时间np8igboo1#
Seems like the
setMedia
method 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
jPlayer
method 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 theoption
method 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.