HahaHortness
HahaHortness

Reputation: 1628

altering header use by html5 audio

I'd like to protect some audio files I'm streaming. I can live without being completely secure but I'd like to require some tech savy from potential downloaders. I've already got some obfuscation in place, but if you can get the obfuscated url you can still download from it. Basically, I'd just like to keep people from browsing to a song.

I tried requiring that the url of my site be in the referer header and that seems to work on Mac and Linux but that header is not sent by Windows browsers. I'd like to know if there is any way to drop any kind of header into the requests made by html5 audio elements. On my server side I'd then have something like.

if header["foo"] != "bar":
    return None

Upvotes: 3

Views: 338

Answers (1)

alex
alex

Reputation: 490433

Requiring the referrer means that users who strip it out for privacy reasons won't hear your audio, in addition, it is easily spoofed.

If you want your audio protected, consider only allowing a short sample or a low bitrate version.

You should protect your files with legalities, not technology.

However, if you request the audio files with XHR, you can add a custom header.

Upvotes: 1

Related Questions