fid = $variables['item']['fid']; $video->original = $variables['item']; $extension = strtolower(pathinfo($variables['item']['filename'], PATHINFO_EXTENSION)); $video->files->{$extension}->filename = pathinfo($variables['item']['filename'], PATHINFO_FILENAME) . '.' . $extension; $video->files->{$extension}->filepath = $variables['item']['uri']; $video->files->{$extension}->url = file_create_url($variables['item']['uri']); $video->files->{$extension}->extension = $extension; // set the player to play $video->player = $extension; $video->width = trim($dimensions[0]); $video->height = trim($dimensions[1]); $video->player_width = trim($player_dimensions[0]); $video->player_height = trim($player_dimensions[1]); // load thumbnail object $video->thumbnail = $this->thumbnail_object($variables); // $video->formatter = $variables['#formatter']; $video->autoplay = variable_get('video_autoplay', FALSE); $video->autobuffering = variable_get('video_autobuffering', TRUE); $video->theora_player = variable_get('video_ogg_player', 'http://theora.org/cortado.jar'); // lets find out if we have transcoded this file and update our paths. if (isset($field_settings['autoconversion']) && $field_settings['autoconversion']) { // discard all existing file data module_load_include('inc', 'video', '/includes/conversion'); $conversion = new video_conversion; if ($conversion->load_job($variables['item']['fid'])) { // reset the video files object and add converted videos in to it $video->files = new stdClass(); $conversion->load_completed_job($video); } } // Let othere module to load the video files by referance // Lets find out if we have pushed this file to the cdn if enabled. // @TODO : add correct filesystem load to this $filesystem = variable_get('video_filesystem', 'drupal'); if ($filesystem != 'drupal' && !module_exists('video_zencoder')) { module_load_include('inc', 'video', '/includes/filesystem'); $filesystem = new video_filesystem(); $filesystem->load_file($video); } // Moved to last to recheck incase we changed our extension above. $video->flash_player = variable_get('video_extension_' . $video->player . '_flash_player', ''); // Return our object return $video; } public function thumbnail_object($variables) { $field_settings = $variables['field']['settings']; $instance_settings = $variables['instance']['settings']; // Build our thumbnail object $thumbnail = new stdClass(); $thumbnail->filepath = ''; $thumbnail->url = ''; //@todo future enhancements for our thumbnails $thumbnail->alt = ''; $thumbnail->title = ''; $thumbnail->description = ''; // Setup our thumbnail path. $default_thumbnail = file_load($field_settings['default_video_thumbnail']); $use_default_img = isset($variables['item']['use_default_video_thumb']) ? $variables['item']['use_default_video_thumb'] : FALSE; if ($use_default_img && !empty($field_settings['default_video_thumbnail'])) { // Check the checkbox to use default thumbnail on node $thumbnail->filepath = $default_thumbnail->uri; } elseif (isset($variables['item']['video_thumb']) ? $variables['item']['video_thumb'] : FALSE) { // actual video thumbnails is present $thumbnail_load = file_load($variables['item']['video_thumb']); $thumbnail->filepath = $thumbnail_load->uri; } else { //need some type of default if nothing is present // drupal_set_message(t('No thumbnail has been configured for the video !title.', array('!title' => $variables['entity']->title)), 'error'); return; } $thumbnail->url = file_create_url($thumbnail->filepath); //swftools appends sites/default/files to the front of our path... //@todo Is this a setting? Need to figure this out. $thumbnail->swfthumb = $thumbnail->filepath; // Return our object return $thumbnail; } }