2

I currently test script an pseudo-streaming for read mp4 files, when I reading everything works fine, but I can not move the timeline? probleme ? my coding (mp4 metadata) is correct because when reading without this code in the player, I can move in the timeline. I use fplayer for read the mp4.

    // ----- NO CACHE -----
session_cache_limiter('nocache');

// General header for no caching
$now = gmdate('D, d M Y H:i:s') . ' GMT';
header('Expires: ' . $now); // rfc2616 - Section 14.21
header('Last-Modified: ' . $now);
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0

// ----- Seek position -----
$seekat = 0;
if (isset($_GET["pos"])) {
    $position = $_GET["pos"];
    if (is_numeric ($position)) {
        $seekat = $position;
    }
    if ($seekat < 0) $seekat = 0;
}

$filename = 'test.mp4'; 
$ext = strrchr($filename, ".");
$prefix = "";
$file = $prefix . $filename;
if (($filename != "") && (file_exists($file)) && ($ext==".mp4")) {
    header("Content-Type: video/x-mp4");
    if ($seekat > 0) header('Content-Length: ' . (filesize($file)-$seekat));
    else header('Content-Length: ' . filesize($file));

    if ($seekat != 0) {
        print("FLV");
        print(pack('C', 1 ));
        print(pack('C', 1 ));
        print(pack('N', 9 ));
        print(pack('N', 9 ));
    }
    $fh = fopen($file, "rb");
    fseek($fh, $seekat);
    while (!feof($fh)) {
        print (fread($fh, 16384));
        // print (fread($fh, filesize($file)));
    }
    fclose($fh);
}

Can you help me thank you.

leppie
  • 115,091
  • 17
  • 196
  • 297
pjfnew
  • 39
  • 4

1 Answers1

0
header("Content-Type: video/x-mp4");

i currently use the same code but even when i stream an mp4 i let the header content as for a flv

Content-Type: video/x-flv

hope it's will help

Smern
  • 18,746
  • 21
  • 72
  • 90