You are here

function html5_media_register_player in HTML5 Media 7

Register a new media player in JavaScript.

1 call to html5_media_register_player()
theme_html5_player in ./html5_media.module
Theme a media player.

File

./html5_media.module, line 150

Code

function html5_media_register_player($settings, $attributes) {
  $playerId = $settings['id'];
  html5_media_add_resources($settings['template'], $settings['debug']);
  $attributes = drupal_json_encode($attributes);

  // Only include the settings that the player cares about.
  $settings = array_intersect_key($settings, html5_media_player_settings());
  $settings = trim(drupal_json_encode($settings), '{}');
  $swfplayer = url(drupal_get_path('module', 'html5_media') . '/player/flash/minplayer.swf');
  drupal_add_js("\n    jQuery(function() {\n      jQuery('#{$playerId}').minplayer({\n        id:'#{$playerId}',\n        attributes:{$attributes},\n        {$settings},\n        swfplayer:'{$swfplayer}'\n      });\n    });\n  ", 'inline');
}