function videojs_add in Video.js (HTML5 Video Player) 6
Same name and namespace in other branches
- 6.2 videojs.module \videojs_add()
- 7.3 videojs.module \videojs_add()
- 7 videojs.module \videojs_add()
- 7.2 videojs.module \videojs_add()
Add the Video.js library to the page.
Parameters
$add: By default this function will add Video.js to the page JavaScript array directly. If wanting to store the Video.js file as an #attached property, set this to FALSE and videojs_add() will only return the needed array suitable for use as an #attached property.
3 calls to videojs_add()
- 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.
- template_preprocess_videojs_view in includes/
videojs.theme.inc - Preprocess function for videojs.tpl.php when displaying a view as a playlist.
File
- ./
videojs.module, line 101 - Provides an HTML5-compatible with Flash-fallback video player.
Code
function videojs_add($add = TRUE) {
static $added = FALSE;
$directory = videojs_get_path();
$return = FALSE;
if (file_exists($directory . '/video.js')) {
$filepath = $directory . '/video.js';
$filepath_css = $directory . '/video-js.css';
}
if (isset($filepath)) {
$videojs_js = drupal_get_path('module', 'videojs') . '/theme/videojs.js';
$videojs_css = drupal_get_path('module', 'videojs') . '/theme/videojs.css';
$settings = array(
'videojs' => array(
'swfPath' => base_path() . videojs_get_path(),
'autoPlay' => (int) variable_get('videojs_autoplay', ''),
),
);
if ($add) {
drupal_add_js($filepath);
drupal_add_css($filepath_css);
drupal_add_js($videojs_js);
drupal_add_css($videojs_css);
if (!$added) {
drupal_add_js($settings, 'setting');
$added = TRUE;
}
}
$return = array(
'js' => array(
array(
'data' => $filepath,
),
array(
'data' => $videojs_js,
),
array(
'data' => $settings,
'type' => 'setting',
),
),
'css' => array(
array(
'data' => $filepath_css,
),
array(
'data' => $videojs_css,
),
),
);
}
return $return;
}