You are here

function theme_video_formatter_video_media_js in Video 6.4

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

File

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

Code

function theme_video_formatter_video_media_js($element) {

  //#913928
  $field = content_fields($element['#field_name'], $element['#type_name']);
  if (!empty($field['list_field']) && !$element['#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($element);

  //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;
}