How to encode or hide audio file url for webpage source

2,537 views
Skip to first unread message

Raj

unread,
Aug 26, 2011, 5:40:31 AM8/26/11
to jpl...@googlegroups.com
Hello
I am facing a problem. I have a project in which i am using jplayer for playing audio files. As for playing audio files we have to pass the audio URL to the player. When i run the page which include the player code on the browser and right click to view the source code, in the source code i am viewing the full url of the audio file but my client not want to expose the location and the audio file name. Can you please help me how to encode or hide the audio URL for viewing in the source code from the browser.

Thanks in advance.

Guillaume Liautard

unread,
Aug 26, 2011, 8:43:56 AM8/26/11
to jpl...@googlegroups.com
Hello,

You could use a PHP script to serve you the file.

I made this code for my videos. So basically, I ask for http://whatever.com/video/1 (url rewriting).
Then ID is assigned the value 1 if it's a number else null and i'm fetching data from MySQL (filename here).
Finally, I set the right headers and read the file.

<?php

if (!is_null($id)) {
    $file = DAOFactory::getEesMediaDAO()->fetch($id);
    if (is_readable('media/sd/' . $file->getFilename())) {
        header('Content-type: video/mp4');
        header("Content-Length: " . filesize('media/sd/' . $file->getFilename()));
        readfile('media/sd/' . $file->getFilename());
    }
}
exit();
?>

Hope it'll help.

Hello
I am facing a problem. I have a project in which i am using jplayer for playing audio files. As for playing audio files we have to pass the audio URL to the player. When i run the page which include the player code on the browser and right click to view the source code, in the source code i am viewing the full url of the audio file but my client not want to expose the location and the audio file name. Can you please help me how to encode or hide the audio URL for viewing in the source code from the browser.

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "jPlayer: HTML5 Audio & Video for jQuery" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jplayer/-/lEHseNlb1oMJ.
To post to this group, send email to jpl...@googlegroups.com.
To unsubscribe from this group, send email to jplayer+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jplayer?hl=en.



--



Jon Spriggs

unread,
Aug 26, 2011, 10:22:52 AM8/26/11
to jpl...@googlegroups.com
It is fundamentally impossible to prevent people from finding the URL
of your file in HTML or Javascript.

You can put up some blockers by doing things like encoding the URLs
using things like Base64, limiting downloads to only X uses from an IP
addresses, you could require a certain header to be supplied, but all,
and I mean *all* of these can be easily circumvented.

If you are publishing any data via HTTP, it must be processable by the
browser, so therefore it must be visible in the browser. If you don't
want to publicly publish your data (albeit, behind a paywall if needs
be, or restricted to a user), once they have *access* to the file, it
is on *their* machine - because they downloaded it in order to play
it. You can't stop that.

Unless you force your users to download a proprietary player, which is
encrypted to hell and back, and require the player to retrieve the
file via HTTPS, which is then stored encrypted on the machine, you
stand a chance of preventing people from re-using it, but even then,
it's just a chance.

Sorry.
--
Jon "The Nice Guy" Spriggs

Joshua Cuevas

unread,
Sep 2, 2018, 9:00:58 AM9/2/18
to jPlayer: HTML5 Audio & Video for jQuery
Question:
 
Could you theoretically take advantage of frequency levels too high to render sound on any normal speaker, and use all of that space to relay one highly encrypted url, that is decrypted by an outside software? 

Abhinav Gupta

unread,
Nov 26, 2018, 8:29:07 AM11/26/18
to jPlayer: HTML5 Audio & Video for jQuery
Thanks for solution
Reply all
Reply to author
Forward
0 new messages