You are here

function video_get_player in Video 6.5

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

Get the object for the suitable player for the parameter resource

1 call to video_get_player()
theme_video_formatter_video_plain in ./video_formatter.inc
Default video cck formatter

File

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

Code

function video_get_player($element) {

  // Setup our node object to be passed along with the player.
  $node = $element['#node'];

  // Setup our video object
  module_load_include('inc', 'video', '/includes/video_helper');
  $video_helper = new video_helper();
  $video = $video_helper
    ->video_object($element);
  if ($video == NULL) {
    return '';
  }

  // Lets spit out our theme based on the extension
  $defaults = video_video_extensions();
  $theme_function = variable_get('video_extension_' . $video->player, $defaults[$video->player]);

  // Lets do some special handling for our flv files to accomdate multiple players.
  if ($theme_function == 'video_play_flv') {
    return theme('video_flv', $video, $node);
  }
  elseif ($theme_function == 'video_play_html5') {
    return theme('video_html5', $video, $node);
  }
  else {
    return theme($theme_function, $video, $node);
  }
}