namespace Fluidbook\Tools\Links;
-class WebVideoLink extends VideoLink
-{
+class WebVideoLink extends VideoLink {
- public static function getVideoAttributes($data, $w = null, $h = null, $compiler = null)
- {
+ public static function getVideoAttributes($data, $w = null, $h = null, $compiler = null) {
$attributes = parent::getVideoAttributes($data, $w, $h, $compiler);
// Since the admin interface doesn't offer options for setting controls or sound, we will set some defaults here
/**
* @throws \JsonException
*/
- public static function getVideoSetup($data, $compiler)
- {
+ public static function getVideoSetup($data, $compiler) {
static::addVideoJS($compiler); // Ensure videoJS core is included first
switch ($data->video_service) {
case 0: // YouTube
+ case 'youtube':
$compiler->addJsLib('videojs-youtube', 'js/libs/videojs/Youtube.js');
// $compiler->addJs('https://rawgit.com/videojs/videojs-youtube/master/dist/Youtube.js');
$setup = [
];
break;
case 1: // Dailymotion
+ case 'dailymotion':
// Todo: add local version of script...
// Note: this plugin doesn't seem to work currently so it is not included
//$compiler->addJs('https://rawgit.com/benjipott/video.js-dailymotion/master/dist-test/videojs-dailymotion.js');
];
break;
case 2: // Vimeo
+ case 'vimeo':
// Todo: add local version of script...
// Note: Vimeo plugin doesn't seem to be working currently - might need updates to work with latest VideoJS module
//$compiler->addJs('https://rawgit.com/videojs/videojs-vimeo/master/dist/videojs-vimeo.min.js');
}
- public function getHTMLContent()
- {
+ public function getHTMLContent() {
if ($this->video_service != 0) {
return self::getEmbed($this);
}
return self::makeVideoTag($this, $w, $h, $this->compiler);
}
- public static function getEmbed($link, $width = null, $height = null)
- {
+ public static function getEmbed($link, $width = null, $height = null) {
if (null === $width) {
$width = $link->width;
}
return '<iframe width="' . $width . '" height="' . $height . '" src="' . self::getEmbedURL($link) . '" frameborder="0" allowfullscreen></iframe>';
}
- public static function getEmbedURL($data)
- {
+ public static function getEmbedURL($data) {
switch ($data->video_service) {
case 0:
+ case 'youtube':
return 'https://www.youtube.com/embed/' . $data->to . '?html5=1';
case 1:
+ case 'dailymotion':
return 'https://www.dailymotion.com/embed/video/' . $data->to;
case 2:
+ case 'vimeo':
return 'https://player.vimeo.com/video/' . $data->to;
case 3:
default:
}
}
- public static function makeVideoTag($link, $width=null, $height=null, $compiler = null)
- {
- if ($link->video_service == 0) {
+ public static function makeVideoTag($link, $width = null, $height = null, $compiler = null) {
+ if ($link->video_service == 0 || $link->video_service == 'youtube') {
return parent::makeVideoTag($link, $width, $height, $compiler);
}
return self::getEmbed($link);