You are here

function mediafront_get_player in MediaFront 7

Same name and namespace in other branches
  1. 6.2 mediafront.module \mediafront_get_player()
  2. 6 mediafront.module \mediafront_get_player()
  3. 7.2 mediafront.module \mediafront_get_player()

Returns a media player.

Parameters

- This can either be an associative array with the settings,: or can be the preset string followed by another argument that is the associative array with the settings you wish to override for that preset.

Example: To show the player with settings...

$params['playlist'] = 'videos'; print mediafront_get_player( $params );

Example: To show the player with the 'mypreset' preset.

print mediafront_get_player( 'mypreset' );

Example: To show the player with the 'mypreset' with the settings overrides.

$params['playlist'] = 'videos'; print mediafront_get_player( 'mypreset', $params );

6 calls to mediafront_get_player()
mediafront_block_content in ./mediafront.module
Content for the media player block.
mediafront_plugin_style_player_advanced::render in views/mediafront_plugin_style_player_advanced.inc
Renders the media player.
mediafront_preset_form in includes/mediafront.preset.inc
theme_mediafront_field in ./mediafront.module
Implement the theme for a view field media player.
theme_mediafront_player in ./mediafront.module
Implement the theme for the media player.

... See full list

File

./mediafront.module, line 973

Code

function mediafront_get_player() {
  $args = func_get_args();
  $params = $args[0];

  // If they pass in a string, then this is a preset.
  // get the preset values.
  if (gettype($params) == 'string') {
    $preset = mediafront_get_preset($params);
    $params = isset($args[1]) ? $preset['settings'] ? array_merge($preset['settings'], $args[1]) : $args[1] : $preset['settings'];
    $params['preset'] = $preset['name'];
    $params['player'] = $preset['player'];
    $params['protocol'] = 'json';
    $params['connect'] = isset($params['connect']) && $params['connect'] ? $params['connect'] : $preset['connect'];
    $params['id'] = isset($params['id']) && $params['id'] ? $params['id'] : 'mediafront_' . $preset['name'];
  }
  if ($params && is_array($params)) {
    $player = $params && $params['player'] ? $params['player'] : 'osmplayer';
    $getPlayer = $player . '_get_player';
    return function_exists($getPlayer) ? $getPlayer($params) : t('Player not available');
  }
  else {
    return t('Player not available');
  }
}