Created
November 20, 2013 15:49
-
-
Save nhart/7565413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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