function brightcove_video_load in Brightcove Video Connect 6.2
Same name and namespace in other branches
- 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.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: Brightcove Studio video ID.
$cache: TRUE or FALSE. Whether to return a video from cache, if present.
Return value
$video Video object or FALSE if video not found.
15 calls to brightcove_video_load()
- brightcove_cck_browser_validate in brightcove_cck/
brightcove_cck.module - Validate callback for the field.
- brightcove_cck_browser_value in brightcove_cck/
brightcove_cck.module - Callback for Brightcove CCK browser widget. Will return a field value in "video-name [id:videoId]" format.
- brightcove_cck_field in brightcove_cck/
brightcove_cck.module - Implementation of hook_field().
- brightcove_cck_handler_field_video::render in brightcove_cck/
views/ brightcove_cck_handler_field_video.inc - brightcove_cck_handler_field_video_date::render in brightcove_cck/
views/ brightcove_cck_handler_field_video_date.inc
File
- ./
brightcove.module, line 167 - 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 = TRUE) {
$cache = brightcove_video_cache_get($video_id);
if (!empty($cache->id) && $id == $cache->id) {
return $cache;
}
else {
$bc = brightcove_initialize();
try {
$video = $bc
->find('find_video_by_id', $video_id);
} catch (Exception $error) {
watchdog('brightcove', 'Loading Brightcove video failed.', array(), WATCHDOG_ERROR);
return FALSE;
}
if (!empty($video->id)) {
brightcove_video_cache_set($video_id, $video);
return $video;
}
}
return FALSE;
}