Jump to content

Recommended Posts

Hey everyone - 

 

Here's the issue that i'm having....

 

I have set  up a player that streams the mp3 file via a php file so the url looks something like this "domain.com/stream.php?file=11222.mp3

 

The issue is that on chrome and on some other browsers (not all) the player cannot be replayed once the audio file is done nor can the user fast forward or back while the file is playing. 

 

Below is the code:

$file = 'path to file';

if(file_exists($file)){
header('Content-type: audio/mpeg');
header('Content-Length: '.filesize($file));
header("Expires: -1");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
readfile($file);
}else{
header("HTTP/1.0 404 Not Found");
}

 

My question what is that i'm doing wrong that is causing this issue? i know it somewhere in there i just can't pin point it, any help is greatly appreciated

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/275978-cant-replay-audio-file-streamed-via-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.