You are here

function theme_video_formatter_video_plain in Video 6.5

Same name and namespace in other branches
  1. 6.4 video_formatter.inc \theme_video_formatter_video_plain()

Default video cck formatter

Makes sure the video being displayed exists and has been converted . If not or the video is processed, then it will get the default player for the specific video type for output.

File

./video_formatter.inc, line 14
Video formatter hooks and callbacks.

Code

function theme_video_formatter_video_plain($element) {
  if (empty($element['#item']['fid'])) {
    return '';
  }

  // Get our field information to determine if we are checking conversion
  $field = content_fields($element['#field_name'], $element['#type_name']);
  if (!empty($field['list_field']) && !$element['#item']['list']) {
    return '';
  }

  // Only needs to be ran if they are converting videos
  if (!empty($field['widget']['autoconversion']) && empty($element['#item']['data']['bypass_autoconversion'])) {
    $transcoder = video_get_transcoder();
    $video = $transcoder
      ->load_job($element['#item']['fid']);
    if (!$video) {
      return '';
    }
    if ($video->status == VIDEO_RENDERING_ACTIVE || $video->status == VIDEO_RENDERING_PENDING) {
      return theme('video_inprogress');
    }
    elseif ($video->status == VIDEO_RENDERING_FAILED) {
      return theme('video_encoding_failed');
    }
  }
  return video_get_player($element);
}