i am using HTML5 audio player as follows :
<audio controls>
<source src="<url>" type="audio/mp3">
</audio>
Now , i want to secure my app , So i want to pass some sessionId in Header parameter in http request for mp3 .
I could not find any way to do this , Please help if anyone knows the solution .
or
Is there any other player which gives this support ? ? ?
To send a GET request with a Bearer Token authorization header, you need to make an HTTP GET request and provide your Bearer Token with the Authorization: Bearer {token} HTTP header.
To send a POST JSON request with a Bearer Token authorization header, you need to make an HTTP POST request, provide your Bearer Token with an Authorization: Bearer {token} HTTP header and give the JSON data in the body of the POST message.
To send a request with the Bearer Token authorization header, you need to make an HTTP request and provide your Bearer Token with the "Authorization: Bearer {token}" header. A Bearer Token is a cryptic string typically generated by the server in response to a login request.
The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a protected resource. The Authorization header is usually, but not always, sent after the user agent first attempts to request a protected resource without credentials.
I think you should use HTMLAudioElement and play audio from javascript instead of html directly. Now when you use javascript you can use secured urls to fetch the audio file and provide it to the Audio Element. This might work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With