streaming video hosting with php handler
i don't know why i use php to do this, but i think php is good enough to do this, the main requirement is create something like streaming video hosting. well, the basic idea is make sure that you have enough space and temp drive to serve thousand usersmoreover, you also need to consider about big-file that user want to watch or download, big framing per buffer can make server down. Some people recommend to use readfile_chunked($stdout) than readfile();
here;s a short simple to make streaming on rtmp protocol in php, the streaming (with rtmp) was runned by OS, the server catch it on stdoutput.
for small size, you can use all in pipes, so it will send on the fly. just like this :
$outfile = tempnam(".", "cmd"); $errfile = tempnam(".", "cmd"); $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $proc = proc_open($cmd, $descriptorspec, $pipes); if (!is_resource($proc)) return 255;
fclose($pipes[0]); //Don't really want to give any input
$exit = proc_close($proc);
..show all:.
.
streaming video hosting with php handler
i don't know why i use php to do this, but i think php is good enough to do this, the main requirement is create something like streaming video hosting. well, the basic idea is make sure that you have enough space and temp drive to serve thousand usersmoreover, you also need to consider about big-file that user want to watch or download, big framing per buffer can make server down. Some people recommend to use readfile_chunked($stdout) than readfile();
here;s a short simple to make streaming on rtmp protocol in php, the streaming (with rtmp) was runned by OS, the server catch it on stdoutput.
for small size, you can use all in pipes, so it will send on the fly. just like this :
$outfile = tempnam(".", "cmd"); $errfile = tempnam(".", "cmd"); $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $proc = proc_open($cmd, $descriptorspec, $pipes); if (!is_resource($proc)) return 255;
fclose($pipes[0]); //Don't really want to give any input
$exit = proc_close($proc);
No comments:
Post a Comment