function _videojs_flashplayer in Video.js (HTML5 Video Player) 6
Same name and namespace in other branches
- 7 includes/videojs.theme.inc \_videojs_flashplayer()
Get flash player fallback
2 calls to _videojs_flashplayer()
- template_preprocess_videojs in includes/
videojs.theme.inc - Preprocess function for videojs.tpl.php when displaying a view as a playlist.
- template_preprocess_videojs_formatter_videojs in includes/
videojs.theme.inc - Preprocess function for videojs.tpl.php when using a playlist.
File
- includes/
videojs.theme.inc, line 185 - Theme and preprocess functions for the Video.js module.
Code
function _videojs_flashplayer($url, $width, $height, $poster, $player_id) {
$autoplay = !!variable_get('videojs_autoplay', FALSE);
$extraheight = variable_get('videojs_flowplayer_extraplayerheight', 24);
if (module_exists('swftools')) {
$options = array(
'params' => array(
'width' => $width,
'height' => $height + $extraheight,
),
);
if ($poster) {
$options['othervars'] = array(
// @todo: swftools bug, can't enable this until they fix their pathing for the images.
'image' => $poster,
'class' => 'vjs-flash-fallback',
);
}
return swf($url, $options);
}
elseif (module_exists('flowplayer')) {
// kjh: use a playlist to display the thumbnail if not auto playing
if (!$autoplay && $poster) {
$options = array(
'playlist' => array(
$poster,
array(
'url' => urlencode($url),
'autoPlay' => $autoplay,
'autoBuffering' => TRUE,
),
),
);
}
else {
$options = array(
'clip' => array(
'url' => urlencode($url),
'autoPlay' => $autoplay,
'autoBuffering' => TRUE,
),
);
}
return theme('flowplayer', $options, $player_id . '-flowplayer', array(
'style' => 'width: ' . $width . 'px; height: ' . ($height + $extraheight) . 'px;',
));
}
else {
$flashvars = array(
'playlist' => array(),
);
if (!empty($poster)) {
$flashvars['playlist'][] = $poster;
}
$flashvars['playlist'][] = array(
'url' => $flash,
'autoPlay' => FALSE,
'autoBuffering' => TRUE,
);
if (function_exists('json_encode')) {
// json_encode() works better wrt & in URLs
$flashvars = rawurlencode(json_encode($flashvars));
}
else {
$flashvars = rawurlencode(drupal_to_js($flashvars));
}
$flowplayer = 'http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf';
$posterhtml = '';
if (!empty($poster)) {
$posterhtml = '<img src="' . check_plain($poster) . '" width="' . $width . '" height="' . $height . '" alt="Poster Image" title="No video playback capabilities." />';
}
$wmode = variable_get('videojs_wmode', '');
$wmodehtml = '';
$wmodeparam = '';
if (!empty($wmode)) {
$wmodehtml = ' wmode="' . check_plain($wmode) . '"';
$wmodeparam = '<param name="wmode" value="' . check_plain($wmode) . '" />';
}
return '<object class="vjs-flash-fallback" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" data="' . $flowplayer . '" id="object-' . check_plain($player_id) . '">
<param name="movie" value="' . $flowplayer . '" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value="config=' . $flashvars . '" />
' . $wmodeparam . '
<embed id="flash-' . check_plain($player_id) . '"
name="flash-' . check_plain($player_id) . '"
src="' . $flowplayer . '"
width="' . $width . '"
height="' . $height . '"
type="application/x-shockwave-flash"
allowscriptaccess="always"
allowfullscreen="true"
' . $wmodehtml . '
flashvars="config=' . $flashvars . '" />
' . $posterhtml . '
</object>';
}
}