You are here

function theme_video_formatter_video_media_js in Video 6.5

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

We are using the jMedia library to output our video files.

@todo Does not work with flv files as this requires an actual flv player. Need to figure out how to best integrate the player into this function.

We are outputing an anchor to the videofile. The jMedia functions will overtake this anchor and setup our object/embed tags.

File

./video_formatter.inc, line 148
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;
}