load_job($variables['item']['fid']); if ($video->video_status == VIDEO_RENDERING_ACTIVE || $video->video_status == VIDEO_RENDERING_PENDING) { return theme('video_inprogress'); } else if ($video->video_status == VIDEO_RENDERING_FAILED) { return theme('video_encoding_failed'); } } return video_get_player($variables); } /* * Renders the video thumbnail as a link to the node page. */ function theme_video_thumbnail($variables) { // Inside a view $variables may contain null data. In that case, just return. if (empty($variables['item']['fid'])) return ''; //setup our thumbnail object module_load_include('inc', 'video', '/includes/video_helper'); $video_helper = new video_helper; // @TODO : change the object to an array $thumbnail = (array) $video_helper->thumbnail_object($variables); // return if no file path found for the video thumbnails and add log message if (empty($thumbnail['filepath'])) { watchdog('video', 'Unable to find the video thumbnail for the %node.', array('%node' => $variables['entity']->title), WATCHDOG_ERROR); return ''; } $image = array( 'path' => $thumbnail['filepath'], 'alt' => $thumbnail['alt'], ); // Do not output an empty 'title' attribute. if (drupal_strlen($thumbnail['title']) > 0) { $image['title'] = $thumbnail['title']; } if ($variables['video_style']) { $image['style_name'] = $variables['video_style']; $output = theme('image_style', $image); } else { $output = theme('image', $image); } if ($variables['path']) { $path = $variables['path']['path']; $options = $variables['path']['options']; // When displaying an image inside a link, the html option must be TRUE. $options['html'] = TRUE; $output = l($output, $path, $options); } return $output; } /* * Renders the video thumbnail linked to the absolute filepath of the video. Colorbox is introduced to handle * the video in an overlay. * * @todo Very unstable, need better methods of integration. Seems hackish right now to find out what flv player is being * used. We are also using jmedia for all other filetypes. */ function theme_video_colorbox($variables, $imagecache = FALSE) { global $base_path; if (!module_exists('colorbox')) { drupal_set_message(t('You must download and enable !colorbox for this formatter.', array('!colorbox' => l(t('Colorbox'), 'http://www.drupal.org/project/colorbox'))), 'error'); return theme('video_formatter_video_nodelink', $variables); } // Inside a view $variables may contain null data. In that case, just return. if (empty($variables['#item']['fid'])) return ''; //load up our media plugins drupal_add_js(drupal_get_path('module', 'video') . '/js/jquery.media.js'); drupal_add_js(drupal_get_path('module', 'video') . '/js/jquery.metadata.js'); drupal_add_js(drupal_get_path('module', 'video') . '/js/flowplayer-3.2.0.min.js'); //setup our video object module_load_include('inc', 'video', '/includes/video_helper'); $video_helper = new video_helper; $video = $video_helper->video_object($variables); $action = swftools_get_action($video->filepath); $player = swftools_get_player($action); $path = explode("_", $player); $player_url = $base_path . swftools_get_player_path() . '/' . $path[0] . '/' . variable_get($player . '_file', ''); if (stristr($player, 'flowplayer')) { $player = 'flowplayer'; } //add our default settings to the Drupal.settings object $settings = array('video' => array( 'flvplayer' => $player_url, 'autoplay' => $video->autoplay, 'autobuffer' => $video->autobuffering, 'player' => $player, )); drupal_add_js($settings, 'setting'); $image = theme('video_image', $video->thumbnail, $video->thumbnail->alt, $video->thumbnail->title, '', TRUE, $imagecache); $class = 'video-box video-' . $variables['#field_name'] . '{width:\'' . $video->player_width . 'px\', height:\'' . $video->player_height . 'px\', player:\'' . $player . '\'}'; return l($image, $video->files->{$video->player}->url, array('attributes' => array('class' => $class), 'html' => TRUE)); } /* * We are using the jMedia library to output our video files. * * @todo Does not work with flv files as this requires an actual flv player. Need to figure out how to best integrate the player * into this function. * * We are outputing an anchor to the videofile. The jMedia functions will overtake this anchor and setup our object/embed tags. */ function theme_video_media_js($variables) { //#913928 $field = content_fields($variables['#field_name'], $variables['#type_name']); if (!empty($field['list_field']) && !$variables['#item']['list']) return ''; drupal_add_js(drupal_get_path('module', 'video') . '/js/jquery.media.js'); drupal_add_js(drupal_get_path('module', 'video') . '/js/jquery.metadata.js'); //setup our video object module_load_include('inc', 'video', '/includes/video_helper'); $video_helper = new video_helper; $video = $video_helper->video_object($variables); //lets output the link to be overtaken by jmedia $link = l($video->filename, $video->files->{$video->player}->url, array('attributes' => array('class' => 'jmedia {width: ' . $video->player_width . ', height: ' . $video->player_height . ', autoplay: ' . $video->autoplay . '}'))); return $link; } /** * Displays a "encoding in progress message" */ function theme_video_inprogress() { return '