function brightcove_video_load in Brightcove Video Connect 7.2
Same name and namespace in other branches
- 6.2 brightcove.module \brightcove_video_load()
- 6 brightcove.module \brightcove_video_load()
- 7.7 brightcove.video.inc \brightcove_video_load()
- 7.3 brightcove.module \brightcove_video_load()
- 7.4 brightcove.module \brightcove_video_load()
- 7.5 brightcove.module \brightcove_video_load()
- 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:
Return value
$video Video object or FALSE if video not found.
11 calls to brightcove_video_load()
- brightcove_field_browser_validate in brightcove_field/
brightcove_field.module - Validate callback for the field.
- brightcove_field_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.
- 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().
- MediaBrightcoveStreamWrapper::getOriginalThumbnailPath in brightcove_media/
MediaBrightcoveStreamWrapper.inc
File
- ./
brightcove.module, line 202 - 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) {
$cache = cache_get('bc:video:' . $video_id, 'cache');
if (!empty($cache->data->id)) {
return $cache->data;
}
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)) {
cache_set('bc:video:' . $video_id, $video, 'cache', $_SERVER['REQUEST_TIME'] + 300);
return $video;
}
}
return FALSE;
}