You are here

function video_players_admin_settings in Video 6.4

Same name and namespace in other branches
  1. 6.5 video.admin.inc \video_players_admin_settings()
  2. 7.2 modules/video_ui/video.admin.inc \video_players_admin_settings()
  3. 7 modules/video_ui/video.admin.inc \video_players_admin_settings()

Video player admin settings

Return value

<type>

1 string reference to 'video_players_admin_settings'
video_menu in ./video.module
Implementation of hook_menu().

File

./video.admin.inc, line 84

Code

function video_players_admin_settings($form_state) {

  // Check for SWF Tools and Amazon S3 Private URLs
  if (module_exists('video_s3') && module_exists('swftools') && variable_get('vid_filesystem', NULL) == 'video_s3' && variable_get('amazon_s3_private', FALSE)) {
    drupal_set_message(t('Using the Flowplayer FLV player via SWF Tools does not work when the S3 %setting-name setting is turned on. Install and enable the <a href="@flowplayer-api-url">Flowplayer API</a> module to use Flowplayer.', array(
      '%setting-name' => t('Enable private file storage'),
      '@flowplayer-api-url' => 'http://drupal.org/project/flowplayer',
    )), 'warning');
  }
  $form = array();
  $form['extensions'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Extensions'),
    '#description' => t('Here you can map specific players to each video extension type.'),
  );

  //lets get all our supported extensions and players.
  $extensions = video_video_extensions();
  $players = video_video_players();
  $flv_players = video_video_flv_players();
  $html5_players = video_video_html5_players();
  foreach ($extensions as $ext => $player) {
    $form['extensions']['video_extension_' . $ext] = array(
      '#type' => 'select',
      '#title' => t('Extension:') . '  ' . $ext,
      '#default_value' => variable_get('video_extension_' . $ext, $player),
      '#options' => $players,
      '#prefix' => '<div class="video_select" rel="' . $ext . '">',
      '#suffix' => '</div>',
    );
    $form['extensions']['video_extension_' . $ext . '_flash_player'] = array(
      '#type' => !empty($flv_players) ? 'radios' : 'markup',
      '#title' => t('Flash Player for') . ' ' . $ext,
      '#value' => !empty($flv_players) ? '' : t('No flash players detected.<br />You need to install !swf_tools or !flowplayer.', array(
        '!swf_tools' => l(t('SWF Tools'), 'http://www.drupal.org/project/swftools'),
        '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'),
      )),
      '#options' => $flv_players,
      '#default_value' => variable_get('video_extension_' . $ext . '_flash_player', ''),
      '#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">',
      '#suffix' => '</div>',
    );
    $form['extensions']['video_extension_' . $ext . '_html5_player'] = array(
      '#type' => !empty($html5_players) ? 'radios' : 'markup',
      '#title' => t('HTML5 Player for') . ' ' . $ext,
      '#value' => !empty($html5_players) ? '' : t('No HTML5 players detected.<br />You need to install !videojs.', array(
        '!videojs' => l(t('Video.js'), 'http://www.drupal.org/project/videojs'),
        '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'),
      )),
      '#options' => $html5_players,
      '#default_value' => variable_get('video_extension_' . $ext . '_html5_player', ''),
      '#prefix' => '<div class="admin_html5_player_wrapper" id="html5_player_' . $ext . '">',
      '#suffix' => '</div>',
    );
  }
  $form['extra'] = array(
    '#type' => 'fieldset',
    '#title' => t('Player Settings'),
  );
  if (isset($flv_players['flowplayer'])) {
    $form['extra']['video_flowplayer_extraplayerheight'] = array(
      '#type' => 'textfield',
      '#title' => t('Flowplayer: add vertical space to accommodate the control bar'),
      '#field_suffix' => 'pixels',
      '#default_value' => variable_get('video_flowplayer_extraplayerheight', 24),
      '#description' => t('The control bar in Flowplayer 3.2 and up uses an overlay on top of the video, so the player size is equal to the video size. For custom control bars or older Flowplayer versions you can use this field to add vertical space to the player height.'),
      '#size' => 5,
      '#maxlength' => 3,
      '#element_validate' => array(
        '_video_validate_number',
      ),
    );
  }
  if (count($form['extra']) == 2) {
    unset($form['extra']);
  }
  return system_settings_form($form);
}