comparison sendstream.php @ 1:f5a9f0eb4858

deleted: LICENSE.ja
author Sushi-k <epgrec@park.mda.or.jp>
date Wed, 08 Jul 2009 11:44:50 +0900
parents
children 8965ef108821
comparison
equal deleted inserted replaced
0:96312e6ab8d4 1:f5a9f0eb4858
1 <?php
2 header("Expires: Thu, 01 Dec 1994 16:00:00 GMT");
3 header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
4 header("Cache-Control: no-cache, must-revalidate");
5 header("Cache-Control: post-check=0, pre-check=0", false);
6 header("Pragma: no-cache");
7
8
9 include_once("config.php");
10 include_once(INSTALL_PATH . "/DBRecord.class.php" );
11 include_once(INSTALL_PATH . "/reclib.php" );
12
13 if( ! isset( $_GET['reserve_id'] )) jdialog("予約番号が指定されていません", "recordedTable.php");
14 $reserve_id = $_GET['reserve_id'];
15
16
17 try{
18 $rrec = new DBRecord( TBL_PREFIX.RESERVE_TBL, "id", $reserve_id );
19
20 $start_time = toTimestamp($rrec->starttime);
21 $end_time = toTimestamp($rrec->endtime );
22 $duration = $end_time - $start_time;
23
24 $size = 3 * 1024 * 1024 * $duration; // 1秒あたり3MBと仮定
25
26 header('Content-type: video/mpeg');
27 header('Content-Disposition: inline; filename="'.$rrec->path.'"');
28 header('Content-Length: ' . $size );
29
30 ob_clean();
31 flush();
32
33 $fp = @fopen( INSTALL_PATH.SPOOL."/".$rrec->path, "r" );
34 if( $fp !== false ) {
35 ob_start(null,4096);
36 $status = array();
37 do {
38 echo fread( $fp, 4096 );
39 if( feof( $fp ) ) break;
40
41 $status = ob_get_status();
42 }
43 while( $status['status'] != PHP_OUTPUT_HANDLER_END );
44 }
45 fclose($fp);
46 }
47 catch(exception $e ) {
48 exit( $e->getMessage() );
49 }
50 ?>