You are here

function theme_video_formatter_video_plain in Video 6.4

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

File

./video_formatter.inc, line 11
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'])) {
    module_load_include('inc', 'video', '/includes/conversion');
    $conversion = new video_conversion();
    $video = $conversion
      ->load_job($element['#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($element);
}