You are here

function theme_video_html5 in Video 7.2

Same name and namespace in other branches
  1. 6.5 video_formatter.inc \theme_video_html5()
  2. 6.4 video_formatter.inc \theme_video_html5()
  3. 7 video.theme.inc \theme_video_html5()

Theme wrapper for HTML5

File

./video.theme.inc, line 269
Theme related functions for the Video module.

Code

function theme_video_html5($variables) {
  $themed_output = NULL;
  $item = $variables['item'];
  $files = $item['playablefiles'];
  $extension = video_utility::getExtension($files[0]->uri);
  $html5_player = variable_get('video_extension_' . $extension . '_html5_player', 'video');
  switch ($html5_player) {
    case 'video':
      $variables['files'] = $files;
      return theme('video_play_html5', $variables);
    case 'audio':
      $variables['files'] = $files;
      return theme('video_play_html5_audio', $variables);
    case 'videojs':
      $items = video_utility::objectToArray($files);
      if (!empty($item['thumbnailfile'])) {
        $thumbnail = video_utility::objectToArray($item['thumbnailfile']);
        $thumbnail['uri'] = $thumbnail['url'];
        $items[] = $thumbnail;
      }
      $attributes = array(
        'width' => $variables['width'],
        'height' => $variables['height'],
      );
      return theme('videojs', array(
        'items' => $items,
        'player_id' => 'video-' . $item['fid'],
        'attributes' => $attributes,
        'entity' => $variables['entity'],
        'entity_type' => $variables['entity_type'],
      ));
    case 'mediaelement':
      $file = reset($files);
      return theme('mediaelement_video', array(
        'attributes' => array(
          'src' => file_create_url($file->uri),
          'height' => $variables['height'],
          'width' => $variables['width'],
        ),
        'settings' => array(
          'download_link' => FALSE,
        ),
      ));
  }
}