You are here

function jw_player_init in JW Player 7

Implements hook_init().

If the player configuration is set to print inline, load the JW Player JavaScript on all pages. Due to caching one never knows when it will be needed.

File

./jw_player.module, line 479
Adds a theme function which allows theme developers to use the JW Player.

Code

function jw_player_init() {
  if (variable_get('jw_player_inline_js', FALSE)) {

    // Add library
    drupal_add_js(libraries_get_path('jwplayer') . '/jwplayer.js');

    // Add key if available.
    if ($key = variable_get('jw_player_key', NULL)) {
      drupal_add_js('jwplayer.key="' . $key . '"', array(
        'type' => 'inline',
        'scope' => 'header',
        'weight' => 5,
      ));
    }
  }
}