You are here

function brightcove_create_classes in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.module \brightcove_create_classes()

Parameters

Entity $client_entity:

Return value

array

34 calls to brightcove_create_classes()
ajax_brightcove_media_upload_callback in brightcove_media/brightcove_media.module
Ajax callback for upload form
BrightcovePlaylistEntityController::delete in ./brightcove.playlist.inc
Overwrites DrupalDefaultEntityController::delete().
BrightcovePlaylistEntityController::save in ./brightcove.playlist.inc
Overwrites EntityAPIController::save().
brightcove_admin_embed_delete_form_submit in ./brightcove.player.inc
Submit handler for brightcove_admin_embed_delete_form().
brightcove_admin_embed_edit_form in ./brightcove.player.inc
Form callback for 'admin/config/media/brightcove/players/%/%/{%/edit,add-embed}'.

... See full list

File

./brightcove.module, line 2552
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_create_classes(Entity $client_entity) {
  if (variable_get('brightcove_disabled')) {
    throw new \Brightcove\API\Exception\APIException("Brightcove API has been disabled in system settings");
  }
  $client = NULL;
  $retry = 5;
  while (!$client && $retry) {
    $client = _brightcove_create_client($client_entity);
    $retry--;
    if (!$client) {
      usleep(250000);
    }
  }
  if (!$client) {
    throw new \Brightcove\API\Exception\AuthenticationException("Failed to authorize with Brightcove.");
  }
  $account = $client_entity->account_id;
  $cms = new \Brightcove\API\CMS($client, $account);
  $di = new \Brightcove\API\DI($client, $account);
  $pm = new \Brightcove\API\PM($client, $account);
  return [
    $cms,
    $di,
    $pm,
  ];
}