Reputation: 23
I use this code below to hide stream url of songs for my wordpress site … this mean instead of: example.com/audio.mp3 url is example.com/streem.php?id=53502
I have tested it with default HTML 5 player and it works on chrome and IE, but this is not working with this player: http://goo.gl/HziDr
Can anybody tell me is my code ok?
Code of streem.php is:
<?php
require('./wp-config.php');
$wp->init();
$wp->parse_request();
$wp->query_posts();
$wp->register_globals();
$attachmentID = $_GET['id'];
$attachment = get_attached_file( $attachmentID , false );
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. (string)filesize($attachment)); // provide file size
header('Content-type: audio/mpeg');
header('Cache-Control: no-cache');
readfile($attachment);
exit;
?>
Upvotes: 0
Views: 3113
Reputation: 4695
I don't know that player, but it's possible that it isn't content-type aware and requires a file extension to work. You could append
'&fmt=.mp3'
to your URL and see if that helps. Your PHP script should ignore that query parameter but hopefully the player will see the .mp3 extension and then work.
Upvotes: 1