function brightcove_video_load in Brightcove Video Connect 7.4
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.2 brightcove.module \brightcove_video_load()
- 7.3 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:
$reset:
Return value
mixed Video object or FALSE if video not found.
8 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.
- brightcove_media_file_formatter_image_view in brightcove_media/
brightcove_media.module - The brightcove_media_image file formatter view callback.
File
- ./
brightcove.module, line 409 - 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;
}