Answer the question
In order to leave comments, you need to log in
How to open a popup window by clicking on a certain link, in which an mp3 file should start playing?
The task is relatively simple - by clicking on a certain link, open a popup window in which the mp3 file should start playing.
The first thing that came to mind was something like this:
header('Content-type: audio/mpeg');
header('Content-length: ' . filesize($filepath));
header('Content-Disposition: inline; filename="'.$filename.'"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
readfile($filepath);
Answer the question
In order to leave comments, you need to log in
There are more tips in this solution:
1) the slider will only work in HTTP/1.1+. Accordingly, with PHP you will not be able to issue content (normally). Put nginx in front, and don't fool yourself. Or stream with streaming tools.
2) play audio via javascript || flash. (if already - describe how you managed to have similar problems)
There is not enough data for the first question to answer. In other places, everything works and no one canceled the firebug.
Refine the problem. (recently I helped a friend in a similar one, the related one is fresh in my memory)
You are using a session. The first request blocks the session (this is a file on the server's disk, it is blocked, the next session will not start until this one is unlocked).
To stream media files, there are a lot of tools. For example - nginx_rtmp_module (if it's a live stream), or you can just stream through nginx. To control access, use X-Accel-Redirect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question