You are here

function _video_common_get_player in Video 6.3

Same name and namespace in other branches
  1. 5 includes/common.inc \_video_common_get_player()
  2. 6 includes/common.inc \_video_common_get_player()
  3. 6.2 includes/common.inc \_video_common_get_player()

Get the object for the suitable player for the parameter resource

1 call to _video_common_get_player()
theme_uploadfield_formatter_video_plain in types/uploadfield/uploadfield_formatter.inc

File

includes/common.inc, line 13
Add some common functions for the various video types supported

Code

function _video_common_get_player($element) {
  $field = content_fields($element['#field_name'], $element['#type_name']);
  $resolution = array_filter(explode(':', $field['widget']['default_resolution']));
  $element['#item']['data']['height'] = $element['#item']['data']['width'] * ($resolution[1] / $resolution[0]);
  $op = _video_get_filetype($element['#item']['filename']);

  //play HQ mp4 videos in flash player
  if (variable_get('mp4_play_in_flowplayer', FALSE) && $op == 'mp4') {
    $op = 'mp4f';
  }
  switch ($op) {
    case 'divx':
      return theme('video_play_divx', $element);
    case 'mov':
    case '3gp':
    case '3g2':
    case 'mp4':

      // video/mp4
      return theme('video_play_quicktime', $element);
    case 'rm':
      return theme('video_play_realmedia', $element);
    case 'mp4f':
    case 'f4v':
    case 'flv':

      // flowplayer also supprts MP4, H.264 (.extension?)
      return theme('video_play_flash', $element);
    case 'swf':
      return theme('video_play_swf', $element);
    case 'dir':
    case 'dcr':
      return theme('video_play_dcr', $element);
    case 'asf':
    case 'wmv':
    case 'avi':
    case 'mpg':
    case 'mpeg':
      return theme('video_play_windowsmedia', $element);
    case 'ogg':
      return theme('video_play_ogg_theora', $element);
    default:
      drupal_set_message('No video player is configured for ' . $op, 'error');
      break;
  }
}