You are here

function brightcove_video_load in Brightcove Video Connect 7.3

Same name and namespace in other branches
  1. 6.2 brightcove.module \brightcove_video_load()
  2. 6 brightcove.module \brightcove_video_load()
  3. 7.7 brightcove.video.inc \brightcove_video_load()
  4. 7.2 brightcove.module \brightcove_video_load()
  5. 7.4 brightcove.module \brightcove_video_load()
  6. 7.5 brightcove.module \brightcove_video_load()
  7. 7.6 brightcove.video.inc \brightcove_video_load()

Loads Brightcove video from BC Media API. Uses a 5 minutes cache to speed up lookups.

Parameters

$video_id:

$reset:

Return value

mixed Video object or FALSE if video not found.

5 calls to brightcove_video_load()
brightcove_field_browser_video_validate in brightcove_field/brightcove_field.module
Validate callback for the video field.
brightcove_field_field_formatter_view in brightcove_field/brightcove_field.module
Implements hook_field_formatter_view().
brightcove_field_field_validate in brightcove_field/brightcove_field.module
Implements hook_field_validate().
brightcove_field_video_browser_value in brightcove_field/brightcove_field.module
Callback for Brightcove field browser widget. Will return a field value in "video-name [id:videoId]" format.
MediaBrightcoveStreamWrapper::getOriginalThumbnailPath in brightcove_media/MediaBrightcoveStreamWrapper.inc

File

./brightcove.module, line 442
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_video_load($video_id, $reset = FALSE) {
  $cid = 'brightcove:video:' . $video_id;
  $cache = brightcove_cache_get($cid);
  if (!empty($cache) && !$reset) {
    return (object) $cache;
  }
  else {
    $bc = brightcove_initialize();
    try {
      $video = $bc ? $bc
        ->find('find_video_by_id', $video_id) : NULL;
    } catch (Exception $error) {
      watchdog('brightcove', 'Loading Brightcove video failed.', array(), WATCHDOG_ERROR);
      return FALSE;
    }
    if (!empty($video->id)) {
      brightcove_cache_set($cid, $video);
      return $video;
    }
  }
  return FALSE;
}