You are here

function videojs_add in Video.js (HTML5 Video Player) 6.2

Same name and namespace in other branches
  1. 6 videojs.module \videojs_add()
  2. 7.3 videojs.module \videojs_add()
  3. 7 videojs.module \videojs_add()
  4. 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.

2 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_view in includes/videojs.theme.inc
Preprocess function for videojs.tpl.php when displaying a view as a playlist.

File

./videojs.module, line 114
Provides an HTML5-compatible with Flash-fallback video player.

Code

function videojs_add($add = TRUE) {
  $directory = videojs_get_path();
  if (!file_exists($directory . '/video.min.js')) {
    return FALSE;
  }
  $libjs = $directory . '/video.min.js';
  $libcss = $directory . '/video-js.min.css';
  if ($add) {
    drupal_add_js($libjs);
    drupal_add_css($libcss);
  }
  return array(
    'js' => array(
      array(
        'data' => $libjs,
      ),
    ),
    'css' => array(
      array(
        'data' => $libcss,
      ),
    ),
  );
}