From: vincent@cubedesigners.com Date: Tue, 3 Nov 2020 11:54:50 +0000 (+0000) Subject: wait #4036 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=92bbbcdd0def1d9bd857735888db509dabd3fb9f;p=cubeextranet.git wait #4036 @0.5 --- diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 71ce65327..be946cc34 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -1144,7 +1144,6 @@ class webVideoLink extends videoLink // Since the admin interface doesn't offer options for setting controls or sound, we will set some defaults here $attributes['controls'] = '1'; $attributes['sound'] = '1'; - $attributes['setup'] = static::getVideoSetup($data, $compiler); return $attributes; @@ -1152,7 +1151,6 @@ class webVideoLink extends videoLink public static function getVideoSetup($data, $compiler) { - static::addVideoJS($compiler); // Ensure videoJS core is included first switch ($data->video_service) { @@ -1207,37 +1205,49 @@ class webVideoLink extends videoLink public function getHTMLContent() { - if ($this->video_service !== 0) { - return $this->getEmbed(); + return self::getEmbed($this); } $w = round($this->width * $this->getCssScale()); $h = round($this->height * $this->getCssScale()); - return $this->makeVideoTag($this, $w, $h, $this->compiler); + return self::makeVideoTag($this, $w, $h, $this->compiler); } - public function getEmbed() + public static function getEmbed($link, $width = null, $height = null) { - return ''; + if (null === $width) { + $width = $link->width; + } + if (null === $height) { + $height = $link->height; + } + return ''; } - public function getEmbedURL() + public static function getEmbedURL($data) { - if ($this->video_service == 0) { - $url = 'https://www.youtube.com/embed/' . $this->to . '?html5=1'; - } elseif ($this->video_service == 1) { - $url = 'https://www.dailymotion.com/embed/video/' . $this->to; - } elseif ($this->video_service == 2) { - $url = 'https://player.vimeo.com/video/' . $this->to; - } elseif ($this->video_service == 3) { - list($playerId, $videoId) = explode('|', $this->to); - $url = 'https://link.brightcove.com/services/player/bcpid' . $playerId . '?bctid=' . $videoId . '&autoStart=false&width=100%25&height=100%25'; + switch ($data->video_service) { + case 0: + return 'https://www.youtube.com/embed/' . $data->to . '?html5=1'; + case 1: + return 'https://www.dailymotion.com/embed/video/' . $data->to; + case 2: + return 'https://player.vimeo.com/video/' . $data->to; + case 3: + default: + return $data->to; } - return $url; } + public static function makeVideoTag($link, $width, $height, $compiler) + { + if ($link->video_service === 0) { + return videoLink::makeVideoTag($link, $width, $height, $compiler); + } + return self::getEmbed($link); + } } class actionLink extends internalLink @@ -1760,29 +1770,15 @@ class htmlMultimediaLink extends wsHTML5Link class webVideoPopupLink extends videoPopupLink { - // public function getURL() { - // if ($this->video_service == 0) { - // $service = 'youtube'; - // } elseif ($this->video_service == 1) { - // $service = 'dailymotion'; - // } elseif ($this->video_service == 2) { - // $service = 'vimeo'; - // } elseif ($this->video_service == 3) { - // $service = 'brightcove'; - // } - // return '#/webvideo/' . $service . '/' . $this->to; - // } - public function getURL() { - switch ($this->video_service) { case 1: // Dailymotion return '#/webvideo/dailymotion/' . $this->to; - break; case 2: // Vimeo return '#/webvideo/vimeo/' . $this->to; - break; + case 3: // Brightcove + return '#/webvideo/brightcove/' . md5($this->to); default: return '#/video/' . $this->to; }