]> _ Git - cubeextranet.git/commitdiff
wait #4036 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 3 Nov 2020 11:54:50 +0000 (11:54 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 3 Nov 2020 11:54:50 +0000 (11:54 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index 71ce65327662674e863193a6f6cc14cbb2330901..be946cc34427943d6bab3332dcbe5367a2401140 100644 (file)
@@ -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 '<iframe width="' . $this->width . '" height="' . $this->height . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
+        if (null === $width) {
+            $width = $link->width;
+        }
+        if (null === $height) {
+            $height = $link->height;
+        }
+        return '<iframe width="' . $width . '" height="' . $height . '" src="' . self::getEmbedURL($link) . '" frameborder="0" allowfullscreen></iframe>';
     }
 
-    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;
         }