public function toObject($object_to_fill = null, $props_to_skip = array()) { if (!$object_to_fill) { $object_to_fill = new kLocalFileResource(); } file_put_contents($fname = tempnam(myContentStorage::getFSUploadsPath(), "KFR"), $this->content); $object_to_fill->setLocalFilePath($fname); $object_to_fill->setSourceType(entry::ENTRY_MEDIA_SOURCE_TEXT); return parent::toObject($object_to_fill, $props_to_skip); }
public function toObject($object_to_fill = null, $props_to_skip = array()) { if (!$object_to_fill) { $object_to_fill = new kLocalFileResource(); } $content = myContentStorage::getFSContentRootPath(); $entryFullPath = "{$content}/content/webcam/{$this->token}.flv"; if (!file_exists($entryFullPath)) { throw new KalturaAPIException(KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND); } $entryFixedFullPath = $entryFullPath . '.fixed.flv'; KalturaLog::debug("Fix webcam full path from [{$entryFullPath}] to [{$entryFixedFullPath}]"); myFlvStaticHandler::fixRed5WebcamFlv($entryFullPath, $entryFixedFullPath); $entryNewFullPath = $entryFullPath . '.clipped.flv'; KalturaLog::debug("Clip webcam full path from [{$entryFixedFullPath}] to [{$entryNewFullPath}]"); myFlvStaticHandler::clipToNewFile($entryFixedFullPath, $entryNewFullPath, 0, 0); $entryFullPath = $entryNewFullPath; if (!file_exists($entryFullPath)) { throw new KalturaAPIException(KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND); } $object_to_fill->setSourceType(KalturaSourceType::WEBCAM); $object_to_fill->setLocalFilePath($entryFullPath); return $object_to_fill; }