You are here

function brightcove_upload_video in Brightcove Video Connect 6

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

Upload video to Brightcove.

Parameters

$path: Filepath to video file.

$meta: Meta data array. Required values: array( 'name' => 'video name', 'shortDescription' => 'short description', );

See also

http://support.brightcove.com/en/docs/media-api-objects-reference#Video

2 calls to brightcove_upload_video()
brightcove_cck_upload_form_submit in brightcove_cck/brightcove_cck.module
Submit callback for brightcove_cck_upload_form.
brightcove_mm_upload_video in ./brightcove.media_mover.inc
Upload a video to Brightcove through Media Mover.

File

./brightcove.module, line 357
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_upload_video($path, $meta) {
  if (empty($meta['name'])) {
    $meta['name'] = t('Video');
  }
  if (empty($meta['shortDescription'])) {
    $meta['shortDescription'] = t('Short Description');
  }
  $bc = _brightcove_initialize();
  try {
    $id = $bc
      ->createMedia('video', $path, $meta);
  } catch (Exception $error) {
    drupal_set_message(t('Video upload to Brightcove failed. Error: @error', array(
      '@error' => $error,
    )), 'error');
    return;
  }
  return $id;
}