Natkeeran
5 years ago
3 changed files with 86 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||||
|
name: 'Islandora Videojs' |
||||||
|
description: 'Islandora Videojs overrides' |
||||||
|
type: module |
||||||
|
package: Islandora |
||||||
|
core: 8.x |
||||||
|
dependencies: |
||||||
|
- islandora |
@ -0,0 +1,56 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
/** |
||||||
|
* @file |
||||||
|
* Contains islandora_videojs.module. |
||||||
|
* |
||||||
|
* This file is part of the Islandora Project. |
||||||
|
* |
||||||
|
* (c) Islandora Foundation |
||||||
|
* |
||||||
|
* For the full copyright and license information, please view the LICENSE |
||||||
|
* file that was distributed with this source code. |
||||||
|
*/ |
||||||
|
|
||||||
|
use Drupal\Core\Routing\RouteMatchInterface; |
||||||
|
|
||||||
|
/** |
||||||
|
* Implements hook_help(). |
||||||
|
*/ |
||||||
|
function islandora_videojs_help($route_name, RouteMatchInterface $route_match) { |
||||||
|
switch ($route_name) { |
||||||
|
// Main module help for the islandora module. |
||||||
|
case 'help.page.islandora_videojs': |
||||||
|
$output = ''; |
||||||
|
$output .= '<h3>' . t('About') . '</h3>'; |
||||||
|
$output .= '<p>' . t('Islandora Videojs overrides.') . '</p>'; |
||||||
|
$output .= '<p>' . t('Customizes videojs.') . '</p>'; |
||||||
|
return $output; |
||||||
|
|
||||||
|
default: |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function islandora_videojs_theme_registry_alter(&$theme_registry) { |
||||||
|
$module_path = drupal_get_path('module', 'islandora_videojs'); |
||||||
|
|
||||||
|
// Use the templates in my module's template folder. |
||||||
|
$theme_registry['videojs'] = $theme_registry['videojs']; |
||||||
|
$theme_registry['videojs']['path'] = $module_path . '/templates'; |
||||||
|
$theme_registry['videojs']['template'] = 'videojs'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
function islandora_videojs_theme($existing, $type, $theme, $path) { |
||||||
|
return array( |
||||||
|
'videojs' => array( |
||||||
|
'variables' => array('items' => NULL, 'player_attributes' => NULL, 'testvar' => 'testvalue'), |
||||||
|
'base hook' => 'videojs' |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,23 @@ |
|||||||
|
{# |
||||||
|
/** |
||||||
|
* @file |
||||||
|
* Default theme implementation to display a formatted video field. |
||||||
|
* |
||||||
|
* Available variables: |
||||||
|
* - items: A collection of videos. |
||||||
|
* - player_attributes: Player options including the following: |
||||||
|
* - width: The width of the video (if known). |
||||||
|
* - height: The height of the video (if known). |
||||||
|
* - autoplay: Autoplay on or off |
||||||
|
* |
||||||
|
* @ingroup themeable |
||||||
|
*/ |
||||||
|
#} |
||||||
|
<h3>Videojs Test {{ testvar }} </h3> |
||||||
|
<video data-setup="{}" class="video-js vjs-default-skin" preload="{{ player_attributes.preload }}" {{ player_attributes.controls ? 'controls' : '' }} style="width:{{ player_attributes.width }}px;height:{{ player_attributes.height }}px;" {{ player_attributes.autoplay ? 'autoplay' : '' }} {{ player_attributes.loop ? 'loop' : '' }} {{ player_attributes.muted ? 'muted' : '' }}> |
||||||
|
{% for user in items %} |
||||||
|
<source src="{{ user }}"/> |
||||||
|
{% endfor %} |
||||||
|
<track srclang="en" label="English" kind="captions" src="http://localhost:8000/_flysystem/fedora/2019-02/MEDIATRACK_en.vtt" default /> |
||||||
|
|
||||||
|
</video> |
Loading…
Reference in new issue