function moveMp4Meta($sFilePath) { require_once BX_DIRECTORY_PATH_PLUGINS . 'moovrelocator/lib/Moovrelocator.class.php'; $oMoovrelocator = new Moovrelocator(); $mixedRet = $oMoovrelocator->relocateMoovAtom($sFilePath, null, true); if ($mixedRet !== true) { return false; } return true; }
/** * instance singleton requester * * method for singleton instantiation of this class * * @return object Instance of this class * @author Benjamin Carl <*****@*****.**> * @version 0.1 * @since Method available since Release 0.1 * @access public */ public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
if ($extension == 'mp4' || $extension == 'm4v') { $new_file_name = $moov_temp_file_name; } else { if (!@unlink($moov_temp_file_name)) { file_put_contents('error.txt', error_get_last(), true); } $new_file_name = $xerte_toolkits_site->root_file_path . $_GET['path'] . $_FILES['Filedata']['name']; } if (!move_uploaded_file($_FILES['Filedata']['tmp_name'], $new_file_name)) { file_put_contents('error.txt', "Save file failed" . error_get_last(), true); exit; } /** * Relocate moov atom if file is .mp4/m4v to support progressive download */ if ($extension == 'mp4' || $extension == 'm4v') { require_once 'tools/moovrelocator/Moovrelocator.class.php'; $moovrelocator = Moovrelocator::getInstance(); $new_file_name = $xerte_toolkits_site->root_file_path . $_GET['path'] . $_FILES['Filedata']['name']; if ($moovrelocator->setInput($moov_temp_file_name) == true) { if ($moovrelocator->setOutput($new_file_name) == true) { if (!(($result = $moovrelocator->fix()) === true)) { file_put_contents('moovrelocator_error.txt', $result, true); if (!copy($moov_temp_file_name, $new_file_name)) { file_put_contents('error.txt', "Copy temp file failed" . error_get_last(), true); exit; } } } } }