You are here

function _videojs_flashplayer in Video.js (HTML5 Video Player) 7

Same name and namespace in other branches
  1. 6 includes/videojs.theme.inc \_videojs_flashplayer()

Get flash player fallback

$url - url to flash media

$width - width

$height - height

$poster - url to the poster image

1 call to _videojs_flashplayer()
template_preprocess_videojs in includes/videojs.theme.inc
Preprocess function for videojs.tpl.php when using a playlist.

File

includes/videojs.theme.inc, line 107
Theme and preprocess functions for the Video.js module.

Code

function _videojs_flashplayer($url, $width, $height, $poster = NULL, $player_id) {
  if (module_exists('flowplayer')) {

    // kjh: use a playlist to display the thumbnail if not auto playing
    if ($poster) {
      $options = array(
        'playlist' => array(
          array(
            'url' => $poster,
            'scaling' => 'fit',
          ),
          array(
            'url' => urlencode($url),
            'autoPlay' => FALSE,
            'autoBuffering' => TRUE,
            'scaling' => 'fit',
          ),
        ),
      );
    }
    else {
      $options = array(
        'clip' => array(
          'url' => urlencode($url),
          'autoPlay' => FALSE,
          'autoBuffering' => TRUE,
          'scaling' => 'fit',
        ),
      );
    }

    // Class must be on a container element because Video.js does not look at
    // elements with multiple classes
    $style = 'width: ' . $width . 'px; height: ' . ($height + 24) . 'px;';
    return '<div class="vjs-flash-fallback" style="' . $style . '">' . theme('flowplayer', array(
      'config' => $options,
      'id' => $player_id . '-flowplayer',
      'attributes' => array(
        'style' => $style,
      ),
    )) . '</div>';
  }
}