function videojs_add in Video.js (HTML5 Video Player) 7.2
Same name and namespace in other branches
- 6.2 videojs.module \videojs_add()
- 6 videojs.module \videojs_add()
- 7.3 videojs.module \videojs_add()
- 7 videojs.module \videojs_add()
Add the Video.js library to the page.
Parameters
$add: By default this function will add videojs 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_view in includes/
videojs.theme.inc - Preprocess function for videojs.tpl.php when displaying a view as a playlist.
- videojs_field_formatter_view in ./
videojs.module - Implements hook_field_formatter_view().
- videojs_preprocess_videojs in includes/
videojs.theme.inc - Preprocess function for videojs.tpl.php when using a playlist.
File
- ./
videojs.module, line 310 - Provides an HTML5-compatible with Flash-fallback video player.
Code
function videojs_add($add = TRUE) {
static $added = FALSE;
if (!isset($added)) {
$added =& drupal_static(__FUNCTION__);
}
$directory = variable_get('videojs_directory', 'sites/all/libraries/video-js');
if (!file_exists($directory . '/video.min.js')) {
return FALSE;
}
$libjs = $directory . '/video.min.js';
$libcss = $directory . '/video-js.min.css';
if ($add && !$added) {
drupal_add_js($libjs, array(
'group' => JS_LIBRARY,
));
drupal_add_css($libcss);
$added = TRUE;
}
return array(
'js' => array(
$libjs => array(
'group' => JS_LIBRARY,
),
),
'css' => array(
$libcss,
),
);
}