I am trying to play an OGG from an octet-stream like follows:
My player.php header sets the audio file like this:
$("#jquery_jplayer").jPlayer({
ready: function () {
this.element.jPlayer("setFile","<?php echo $audio_link; ?>","<?php
echo $audio_link; ?>").jPlayer("play");
},
volume: 50,
oggSupport: true
})
The variable $audio_link has the value audio_link.php that looks like
this:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;
filename='.basename($target_filename));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: no-cache, must-revalidate, post-check=0, pre-
check=0');
header('Pragma: public');
header('Content-Length: '.GetRemoteFileSize($audio_link) );
header('Accept-Ranges: bytes');
ob_clean();
flush();
@readfile($download_link);
GetRemoteFileSize returns the correct size and all the variables have
correct values, but the audio does not play. I am using the same
approach with images and video and they work OK.
Can anyone please point me in the right direction?
Thanks in advance and keep the excellent work!
Juan M.
The browsers that play OGG format are fussy about the mime type. It
has to be application/ogg or audio/ogg for it to work.
The other thing, it looks like you give the same URL for the mp3 and
ogg files. You give no details of which browsers do or do not work...
When you set oggSupport to true, the 2nd file parameter must point to
an OGG format otherwise jPlayer will not work.
@Wurlitzer: Search this group and you should find info on hiding the
mp3 urls. The best approach seems to be to restrict the referrer URL
to disable direct access. You can parse the mp3 file through a PHP
file, but it would take up server resources and you have to make it
'accept-ranges' correctly.
Best regards,
Mark P.