You are here

function brightcove_initialize in Brightcove Video Connect 7.5

Same name and namespace in other branches
  1. 6.2 brightcove.module \brightcove_initialize()
  2. 7.2 brightcove.module \brightcove_initialize()
  3. 7.3 brightcove.module \brightcove_initialize()
  4. 7.4 brightcove.module \brightcove_initialize()

Initializes the Brightcove Media API and returns an instance of the object.

Parameters

string $read_token: An optional read token instead of the stored one.

string $write_token: An optional write token instead of the stored one.

Return value

BCMAPI Instance of the Brightcove Media API or FALSE if fails to initialize.

17 calls to brightcove_initialize()
brightcove_add_logo_overlay in ./brightcove.module
Add a logo overlay to a video object. This function is also upload the logo image.
brightcove_add_playlist in ./brightcove.module
Wrapper function around playlist save.
brightcove_autocomplete_videos in ./brightcove.module
Autocomplete callback for listing videos.
brightcove_field_autocomplete in brightcove_field/brightcove_field.browse.inc
Menu callback for brightcove_field/autocomplete.
brightcove_field_browser_video_validate in brightcove_field/brightcove_field.module
Validate callback for the video field.

... See full list

File

./brightcove.module, line 365
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_initialize($read_token = NULL, $write_token = NULL) {
  if (empty($read_token)) {
    $read_token = variable_get('brightcove_read_api_key', '');
  }
  if (empty($write_token)) {
    $write_token = variable_get('brightcove_write_api_key', '');
  }
  if (empty($read_token)) {
    drupal_set_message(t('Cannot initialize Brightcove API. Contact site administrators.'), 'error');
    watchdog('brightcove', 'Brightcove Read API keys not found, cannot initialize Brightcove MAPI SDK.', array(), WATCHDOG_ERROR);
    return FALSE;
  }
  include_once brightcove_mapi_path() . '/bc-mapi.php';
  $bc = new BCMAPI($read_token, $write_token);
  return $bc;
}