Streaming in PHP
I'm searching the best way to do what I'm trying to do, so I ask here... I have a webpage in PHP who's requesting a song 开发者_开发百科by TCP to another server. The song is loaded into a temporary file on the server. While it's loading, I want to play it into the webpage OR into the user's favorite player. Is it possible to simply refer the file to the player, even if it's not fully loaded ?
Thanks !
EDIT:
I found a great open-source player named JW Player, seems to be able to do what I want, but I'm not sure how ...
its a little hard to understand what your asking.
PHP Does not have threads which will limit you in multiple tasks, but it is possible to do so
the problem is that if your fetching the file in the same php file that loads the player as a webpage then your going to have issues.
you will have to resort to several php pages to complete the task
Firstly the suer requests to the server the song he wishes to play, you will have to use ajax to infrom the server of the id, so you would ping a script on your server saying LOAD VIDEO ID XXXX
in which that script starts downloading the video, you would then active the player to call another file that would read segments of the partially downloaded file and output it to the player.
it will get very complex and possibly very error prone, your best bet is to stream directly from server2
Yes possible but you should indicate size of file truely
精彩评论