[Plugin: Audio Player] Encode mp3 URLs?
-
I have the Encode mp3 URLs option enabled in audio player but it does not work. The MP3 urls are not encoded at all, does anyone have a solution?
-
bump.
Encoding works for me. Have you fixed this or is it still a problem?
Martin
No it’s still a big problem.
My mp3 files are getting indexed by other websites when I would rather they were kept private.
Can you post a URL to an example page where this is happening?
Martin
https://www.detailsofmylife.net/music/ellie-goulding-radio-1s-live-lounge/
If I use Safari, click play on either of the links then the activity monitor links directly to the mp3 file in question, there is no encoding of the URL to prevent people from snatching it.
Thanks for the interest and quick responses by the way. Apart from this problem the plug-in is absolutely fantastic.
Ah OK. You misunderstood what encoding means (and I probably didn’t explain it very well either). Encoding means that the URL passed to the Flash player is encoded. The Flash player then decodes it and requests the plain decoded URL. So if someone looks at the HTML source of your site, they won’t be able to find the plain mp3 URL. However, as you found out, you can easily find the URL by monitoring activity. There is no way to completely secure mp3 files with Audio Player. The player has to be able to access the URL to play it so someone with enough web knowledge will be able to donwload the file. If you don’t want this to happen, Audio Player is not for you unfortunately.
Martin
Hi Martin,
I have noticed that another blog (OnSmash) uses Audio Player. However, when I use the activity monitor on their website when playing a song, copy the streaming URL for the audio file, then access it in a new window, the server says that the file does not exist?
Compared to an absolute URL from my site:
[audio src="https://www.detailsofmylife.net/wp-content/uploads/2010/02/[email protected]" /]
theirs looks like this:
This is the reason why I got confused by audio encoding because it seems like they have found a way to protect the file but still allow audio player to access it when requested?
Yep, looks like they implemented some kind of protection against direct downloads of their mp3s. Although my guess is that their system is more for tracking how many times visitors play the track. It’s probably still possible to get the downloaded mp3 file from the browser’s cache anyway.
I’m sure there are methods out there to make it more difficult for visitors to download your mp3s but I have never needed this so my guess is as good as yours.
Martin
Hey Piatti, did you resolved your problem?
Please let me know, im lookin’ for the same solution.
??
That’s an interesting point about the absolute url versus one covered by a php file.
I’m trying to implement my version using a php file like this:
<script type="text/javascript"> AudioPlayer.embed("audioplayer_1", {soundFile: "/preview.php?file={title}.mp3"}); </script>
But it’s currently telling me the file is not found. I know for a fact that the file and the php file are both correct and in the right places, as using an object command finds the files. I’d just much rather use this plugin as it’s cleaner.
Thusly, is there a way to make it access mp3’s via the php file, as opposed to an absolute link?
Thanks!
Ive been thinkin about that way… can u share the code of the preview.php file?
Maybe i can help you to find a way.
Thanks! ??Awesome, if you have any thoughts It’d really help me!
The PHP code reads:
<?php header('Content-type: audio/mp3'); $path='/path/to/my/files/belowthe/webroot/'; if (isset($_GET['file'])) { $filename=basename($_GET['file']); // only the "filename.ext" part if (!file_exists($path.$filename)) { // file not found die(); } } else { // no file given in URL die(); } readfile($path.$filename); // read and output file ?>
Thanks!
I got it! Example: https://www.luismaria.net/try.php
This is the code 4 the script:
<script type="text/javascript"> AudioPlayer.embed("audioplayer_1", {soundFile: "/dw.php?file=belen.mp3"}); </script>
And the php file:
<?php $path = $_SERVER['DOCUMENT_ROOT']."/audio/mp3/"; // change the path to fit your websites document structure $fullPath = $path.$_GET['file']; if ($fd = fopen ($fullPath, "r")) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf": header("Content-type: application/mp3"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); } header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; ?>
Works perfect to me. Now, im going to try a way to stop hotlink, and the end, maybe theres a way to adapt the wordpress plugin. ??
Dude, awesome! Thanks for sharing…
I still can’t get this working though… I wonder if it’s because I’m trying to store the mp3 files outside of the webroot… does that make a difference to your working version, if you move the files you’ve linking to, outside the webroot?
Yes i think so. The track must to be in the path that you choose.
- The topic ‘[Plugin: Audio Player] Encode mp3 URLs?’ is closed to new replies.