
25-09-08, 10:14
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 1
Rep Power: 0
|
|
|
Streaming sound with AS3 and PHP
|
|
Hi all,
I am currentlly coding a website all flash an coded in AS3.
I have coded a fully customized mp3 player which uses XML data from the server to access the playlist. It is all working fine, tested it many times and no problems.
The thing is that the tunes which are streamed from the server should not really reside anywhere within the publicly accessible folder since my client doesn't want anyone to just go around his public directory and download them without first loging-in to the members page (where the player is) . So I have created a folder outside the public folder in my home directory (which cannot be accessed publicly) to store all the songs there . Now to play the songs in the player I needed to stream them somehow to the browser so I am using a PHP script (literally four lines of code) that strreams a given tune from that outside folder. Here is where the problem lies:
When a user chooses a tune to be played the AS3 code calls the PHP code on the server passing it the title of the song (which it earlier got from the XML playlist file) which in turn starts streaming the song. And here I am becoming confused how the things actually run and how to fix the following. The sound will actually start playing normally in the player (as it is in AS3 a new Sound object is created and so on) and I can still stop, pause and play from the paused moment again . But tere are things that won't work : for example... the load progress bar along with the search slider do not work any more. Now I understand (and have already confirmed by testing it in flash) that the fact that the sound is streamed through PHP from the server has got to do with the fact that the Sound object in my AS3 code somehow doesn't have information necessary to calculate all the things that are used by the load bar and search - it doesn't have the lenght of the song. So my code cannot also calculate the progress loaded and so on ... So it looks as if the flash player has some control over the played sound but not entirely .. however weird or it may sound ..
Perhaps there is some other better way to do it (stream the tunes from outside my public folder) , or maybe a change to the PHP code could solve this problem. Is there any way that would make it work 100% as it did when the songs where loaded straight into the payer straight from the public folder just with AS3 ..
As I am not an AS3/PHP expert any help will be much appreciated. Posted this already a week ago on the Adobe Flash Support forum but didn't get a single post back.
K |
|