FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » detecting a file in use
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: detecting a file in use [message #183650 is a reply to message #183648] Wed, 06 November 2013 17:36 Go to previous messageGo to previous message
Tobiah is currently offline  Tobiah
Messages: 30
Registered: April 2011
Karma:
Member
On 11/06/2013 09:12 AM, richard wrote:
> What should be used to know when a request has been made for the server to
> load an audio file?
> As I see it, the server has to know that a request has been made.
>
> You, the user, using your browser, sees a list of songs that you can play.
> You click that link, the browser sends a request to fetch that file.
> This is the point in time when I want to know that the request has been
> made.
> Javascript takes care of the playing side.
> But still, the server has to have some way of knowing which audio file is
> being requested and whether or not buffering is needed.
>
> Now that the audio file has played, the server needs to know that file has
> completed downloading.
> So what do I use to know this has happened?
>

What you probably want is to use a PHP script that is masquerading as
the audio file. You can make a directory called 'my_song.wav', and have
an index.php inside that directory. At least with Apache, it will detect
the directory and instead load the index.php file. Your PHP code in that file can
introspect it's request with $PHP_SELF and find out what song was asked
for. Then, you can fopen() the real audio file (could be a sibling of
index.php, or in some other audio directory), and print it out to the
browser. Now your are in PHP, and you know that the request for the
song has been made. You won't be able to tell when the song
has finished, because there will be output buffering going on.

You may be able to do ob_start() before you print the .wav content,
then when you do ob_end_clean(), I would guess that when that statement
has finished you at least know that the server is done sending the
audio content. That still doesn't guarantee that the user has heard the
end of the song on their end however.


Tobiah
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: accessing nested unknown unserialized objects
Next Topic: detection of 2d array?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 12:11:25 GMT 2024

Total time taken to generate the page: 0.03939 seconds