doNotUseXsendFile); if (file_exists($path)) { $filesize = filesize($path); if (!empty($_GET['download'])) { if (empty($_REQUEST['cacheDownload']) && !CustomizeUser::canDownloadVideos()) { _error_log("downloadHLS: CustomizeUser::canDownloadVideos said NO"); forbiddenPage("Can't download this"); } if (!empty($_GET['title'])) { $quoted = safeString($_GET['title'], true).".{$path_parts['extension']}"; } else { $quoted = safeString(basename($_GET['file']), true).".{$path_parts['extension']}"; } //header('Content-Type: application/json');var_dump($quoted);exit; header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $quoted); header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } if (preg_match("/(mp4|webm|m3u8|mp3|ogg)/i", $path_parts['extension'])) { if (isAVideoEncoderOnSameDomain() || empty($_GET['ignoreXsendfilePreVideoPlay'])) { AVideoPlugin::xsendfilePreVideoPlay(); } if (empty($advancedCustom->doNotUseXsendFile)) { //_error_log("X-Sendfile: {$path}"); header("X-Sendfile: {$path}"); } else { _error_log("Careful, we recommend you to use the X-Sendfile and it is disabled on AdvancedCustom plugin -> doNotUseXsendFile. You may have an error 'Allowed Memory Size Exhausted' if your video file is too big", AVideoLog::$WARNING); } } else { $advancedCustom->doNotUseXsendFile = true; } header("Content-type: " . mime_content_type($path)); header('Content-Length: ' . $filesize); //header("Content-Range: 0-".($filesize-1)."/".$filesize); //_error_log("downloadHLS: filesize={$filesize} {$path}"); //var_dump($advancedCustom->doNotUseXsendFile);exit; if (!empty($advancedCustom->doNotUseXsendFile)) { ini_set('memory_limit', filesize($path) * 1.5); _error_log("Your XSEND File is not enabled, it may slow down your site, file = $path", AVideoLog::$WARNING); //echo url_get_contents($path); // stream the file $fp = fopen($path, 'rb'); fpassthru($fp); } die(); } else { _error_log("XSENDFILE ERROR: Not exists path={$path} file={$file} ". json_encode($_GET)); }