public function output() { if ($this->maxAge && isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == infraRequestUtils::formatHttpTime($this->lastModified)) { infraRequestUtils::sendCachingHeaders($this->maxAge, false, $this->lastModified); header("HTTP/1.1 304 Not Modified"); return; } $useXsendFile = false; $rangeLength = null; if (!$this->fileData && $this->xSendFileAllowed && in_array('mod_xsendfile', apache_get_modules())) { $useXsendFile = true; } else { list($rangeFrom, $rangeTo, $rangeLength) = infraRequestUtils::handleRangeRequest($this->fileSize); } if (class_exists('KalturaMonitorClient')) { KalturaMonitorClient::monitorDumpFile($this->fileSize, $this->filePath); } infraRequestUtils::sendCdnHeaders($this->fileExt, $rangeLength, $this->maxAge, $this->mimeType, false, $this->lastModified); // return "Accept-Ranges: bytes" header. Firefox looks for it when playing ogg video files // upon detecting this header it cancels its original request and starts sending byte range requests header("Accept-Ranges: bytes"); header("Access-Control-Allow-Origin:*"); if ($this->fileData) { echo substr($this->fileData, $rangeFrom, $rangeLength); } else { if ($useXsendFile) { header('X-Kaltura-Sendfile:'); header("X-Sendfile: {$this->filePath}"); } else { infraRequestUtils::dumpFilePart($this->filePath, $rangeFrom, $rangeLength); } } }