You are here

function brightcove_add_logo_overlay in Brightcove Video Connect 7.4

Same name and namespace in other branches
  1. 7.3 brightcove.module \brightcove_add_logo_overlay()
  2. 7.5 brightcove.module \brightcove_add_logo_overlay()

Add a logo overlay to a video object. This function is also upload the logo image.

Parameters

string $video_id:

string $ref_id:

object $image:

string $params:

1 call to brightcove_add_logo_overlay()
_brightcove_upload_form_callback in ./brightcove.module
Upload the submitted video.

File

./brightcove.module, line 485
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_add_logo_overlay($video_id, $ref_id, $image, $params = NULL) {
  $result = FALSE;
  if (empty($video_id) || empty($ref_id) || empty($image)) {
    return FALSE;
  }

  // Initialize a brightcove connection.
  $bc = brightcove_initialize();

  // The local path of the image.
  $image_path = drupal_realpath($image->uri);

  // Initialize the logo structure.
  $meta = array(
    'image' => array(
      'referenceId' => $image->fid,
      'type' => BRIGHTCOVE_LOGO_IMAGE_TYPE,
      'displayName' => $image->filename,
    ),
    // The default alignment is BOTTOM_RIGHT
    'alignment' => isset($params['alignment']) ? $params['alignment'] : BRIGHTCOVE_LOGO_BOTTOM_RIGHT,
  );
  if (isset($params['tooltip'])) {
    $meta['tooltip'] = $params['tooltip'];
  }
  if (isset($params['linkURL'])) {
    $meta['linkURL'] = $params['linkURL'];
  }
  try {
    $result = $bc
      ->createOverlay($image_path, $meta, $video_id, $ref_id);
  } catch (Exception $exception) {
    watchdog_exception('brightcove', $exception);
  }
  return $result;
}