Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11740 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-11-06 12:12 -0500 |
| Last post | 2013-11-06 19:01 +0100 |
| Articles | 5 — 5 participants |
Back to article view | Back to comp.lang.php
detecting a file in use richard <noreply@example.com> - 2013-11-06 12:12 -0500
Re: detecting a file in use "J.O. Aho" <user@example.net> - 2013-11-06 18:34 +0100
Re: detecting a file in use Tobiah <toby@tobiah.org> - 2013-11-06 09:36 -0800
Re: detecting a file in use The Natural Philosopher <tnp@invalid.invalid> - 2013-11-06 17:36 +0000
Re: detecting a file in use Luuk <luuk@invalid.lan> - 2013-11-06 19:01 +0100
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-11-06 12:12 -0500 |
| Subject | detecting a file in use |
| Message-ID | <19q44k7e0oext.1x1a126s3btq$.dlg@40tude.net> |
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?
[toc] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-11-06 18:34 +0100 |
| Message-ID | <bdvcthFsctU1@mid.individual.net> |
| In reply to | #11740 |
On 06/11/13 18:12, 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. three ways to do it Simple: parse the log file Medium: use a wrapper file which notify that someone requested a file and then serve the file, this can destroy fast forward/rewind/pause/resume features. Complicated: Make the JavaScript to call a page and tell which file the user is loading and if they do buffer or not. > 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? If you use wrapper and the page terminates, then it's finished with the download. If you use the javascript then make an ajax call and tell that the song has finished to play. -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | Tobiah <toby@tobiah.org> |
|---|---|
| Date | 2013-11-06 09:36 -0800 |
| Message-ID | <A6veu.135243$ZQ7.45301@fx18.iad> |
| In reply to | #11740 |
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
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-11-06 17:36 +0000 |
| Message-ID | <l5dunq$a6f$2@news.albasani.net> |
| In reply to | #11740 |
On 06/11/13 17:12, 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? > YOU don't. The operating system knows, because the IP connection has (probably) gone. The file may or may not remain in cache depending on how much RAM the server has, and how busy it is. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2013-11-06 19:01 +0100 |
| Message-ID | <jocqka-l9j.ln1@luuk.invalid.lan> |
| In reply to | #11740 |
On 06-11-2013 18:12, 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? > You need to have a basic understanding of the HTTP-protocol. This is (i think it is) considered off-topic in comp.lang.php Maybe microsoft.public.winhttp is a good place to ask?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web