Skip to content

Instantly share code, notes, and snippets.

@nhart
Created November 20, 2013 15:49
Show Gist options
  • Save nhart/7565413 to your computer and use it in GitHub Desktop.
Save nhart/7565413 to your computer and use it in GitHub Desktop.
function yourthemename_preprocess_islandora_video(&$variables) {
$viewer_dsid = 'MP4';
$object = $variables['object'];
$video_params = array(
'pid' => $object->id,
);
if (isset($object[$viewer_dsid]) && islandora_datastream_access(FEDORA_VIEW_OBJECTS, $object[$viewer_dsid])) {
$video_url = url("islandora/object/{$object->id}/datastream/$viewer_dsid/view");
$video_params += array(
'mime' => 'video/mp4',
'url' => $video_url,
);
}
// Thumbnail.
if (isset($object['TN']) && islandora_datastream_access(FEDORA_VIEW_OBJECTS, $object['TN'])) {
$video_params += array(
'tn' => url("islandora/object/{$object->id}/datastream/TN/view", array('absolute' => TRUE)),
);
}
$viewer = islandora_get_viewer($video_params, 'islandora_video_viewers', $object);
$variables['islandora_content'] = '';
if ($viewer) {
$variables['islandora_content'] = $viewer;
}
else {
$variables['islandora_content'] = NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment