Archives
// function to parse a video function parseVideoEntry($entry) { $obj= new stdClass; // get nodes in media: namespace for media information $media = $entry->children(‘http://search.yahoo.com/mrss/’); $obj->title = $media->group->title; $obj->description = $media->group->description; // get video player URL $attrs = $media->group->player->attributes(); $obj->watchURL = $attrs['url']; // get video thumbnail $attrs = $media->group->thumbnail[0]->attributes(); $obj->thumbnailURL = $attrs['url']; // get node for [...]
I use this function to determine duration of a FLV file. It works pretty cool. function mbmGetFLVDuration($file){ // read file if (file_exists($file)){ $handle = fopen($file, “r”); $contents = fread($handle, filesize($file)); fclose($handle); if (strlen($contents) > 3){ if (substr($contents,0,3) == “FLV”){ $taglen = hexdec(bin2hex(substr($contents,strlen($contents)-3))); if (strlen($contents) > $taglen){ $duration = hexdec(bin2hex(substr($contents,strlen($contents)-$taglen,3))); return $duration; } } } } [...]