/** * Returns the start point of the file as a Timecode object if available, otherwise returns null. * * @access public * @author Oliver Lillie * @param boolean $read_from_cache * @return mixed Returns a string 'audio' or 'video' if media is audio or video, otherwise returns null. */ public function readType($read_from_cache = true) { return parent::getFileType($this->_media_file_path, $read_from_cache); }
/** * Attempts to read the data about the file given by $path and then returns the class * name of the related media object. * * @access protected * @author Oliver Lillie * @param string $path The file pathe of the file to find the media class for. * @return string Returns the class name of the PHPVideoToolkit class related to the given $path argument. */ protected function _findMediaClass($path) { // read the output to determine what it is so it can be post processed. $data = getimagesize($path); if (!$data) { $media_parser = new MediaParser($this->_config); $type = $media_parser->getFileType($path); } else { if (strpos($data['mime'], 'image/') !== false) { $type = 'image'; } else { $type = 'video'; } } // now we have the information switch between the types and create the return object. $class = 'Media'; switch ($type) { case 'audio': case 'video': case 'image': $class = '\\PHPVideoToolkit\\' . ucfirst(strtolower($type)); break; } return $class; }