You are here

function theme_video_flv in Video 7

Same name and namespace in other branches
  1. 6.5 video_formatter.inc \theme_video_flv()
  2. 6.4 video_formatter.inc \theme_video_flv()
  3. 7.2 video.theme.inc \theme_video_flv()
1 theme call to theme_video_flv()
theme_video in ./video.theme.inc

File

./video.theme.inc, line 178

Code

function theme_video_flv($variables) {
  $video = $variables['video'];

  // set the video flash player
  // Moved to last to recheck incase we changed our extension above.
  $video->flash_player = variable_get('video_extension_' . $video->player . '_flash_player', '');
  switch ($video->flash_player) {
    case 'swftools':
      $options = array(
        'params' => array(
          'width' => $video->player_width,
          'height' => $video->player_height,
        ),
        'othervars' => array(
          //@todo: swftools bug, can't enable this until they fix their pathing for the images.
          'image' => $video->thumbnail->swfthumb,
        ),
      );
      $themed_output = swf($video->files->{$video->player}->url, $options);
      break;
    case 'flowplayer':

      // kjh: use a playlist to display the thumbnail if not auto playing
      if (isset($video->autoplay) && isset($video->thumbnail->url)) {
        $options = array(
          'playlist' => array(
            $video->thumbnail->url,
            array(
              'url' => urlencode($video->files->{$video->player}->url),
              'autoPlay' => $video->autoplay,
              'autoBuffering' => $video->autobuffering,
            ),
          ),
        );
      }
      else {
        $options = array(
          'clip' => array(
            'url' => urlencode($video->files->{$video->player}->url),
            'autoPlay' => $video->autoplay,
            'autoBuffering' => $video->autobuffering,
          ),
        );
      }
      $themed_output = theme('flowplayer', array(
        'config' => $options,
        'id' => 'flowplayer-' . $video->formatter,
        'attributes' => array(
          'style' => 'width:' . $video->player_width . 'px;height:' . ($video->player_height + 24) . 'px;',
        ),
      ));
      break;
    default:
      $themed_output = t('No flash player has been setup. ' . l(t('Please select a player to play Flash videos.'), 'admin/settings/video/players'));
      break;
  }
  return theme('video_play_flv', array(
    'video' => $video,
    'themed_output' => $themed_output,
  ));
}