Browse Source

Fixing YouTube, Vimeo and Dailymotion video integration

Cebabonet 7 years ago
parent
commit
b43ca639a3
2 changed files with 6 additions and 5 deletions
  1. 3 3
      classes/sorbet.class.php
  2. 3 2
      classes/util.class.php

+ 3 - 3
classes/sorbet.class.php View File

176
         $util_class = new util();
176
         $util_class = new util();
177
         if ($util_class->isYoutubeVideo($url)) {
177
         if ($util_class->isYoutubeVideo($url)) {
178
             $id_video = $util_class->getYoutubeVideoUrl($url);
178
             $id_video = $util_class->getYoutubeVideoUrl($url);
179
-            return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.youtube.com/v/".$id_video."\"><param name=\"movie\" value=\"http://www.youtube.com/v/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
179
+            return "\t\t\t<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/".$id_video."\" frameborder=\"0\" allowfullscreen></iframe>\n";
180
         } elseif ($util_class->isVimeoVideo($url)) {
180
         } elseif ($util_class->isVimeoVideo($url)) {
181
             $id_video = $util_class->getVimeoVideoUrl($url);
181
             $id_video = $util_class->getVimeoVideoUrl($url);
182
-            return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
182
+            return "\t\t\t<iframe src=\"https://player.vimeo.com/video/".$id_video."\" width=\"640\" height=\"360\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\n";
183
         } elseif ($util_class->isDailymotionVideo($url)) {
183
         } elseif ($util_class->isDailymotionVideo($url)) {
184
             $id_video = $util_class->getDailymotionVideoUrl($url);
184
             $id_video = $util_class->getDailymotionVideoUrl($url);
185
-            return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.dailymotion.com/swf/".$id_video."\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
185
+            return "\t\t\t<iframe frameborder=\"0\" width=\"640\" height=\"360\" src=\"//www.dailymotion.com/embed/video/".$id_video."\" allowfullscreen></iframe><br />\n";
186
         } elseif ($util_class->isYahooVideo($url)) {
186
         } elseif ($util_class->isYahooVideo($url)) {
187
             $id_video = $util_class->getYahooVideoCode($url);
187
             $id_video = $util_class->getYahooVideoCode($url);
188
             return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
188
             return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";

+ 3 - 2
classes/util.class.php View File

150
     public function isVimeoVideo($videoUrl)
150
     public function isVimeoVideo($videoUrl)
151
     {
151
     {
152
         $util_class = new util();
152
         $util_class = new util();
153
-        if ($util_class->beginsWith($videoUrl, "http://vimeo.com/") || $util_class->beginsWith($videoUrl, "http://www.vimeo.com/")) {
153
+        if ($util_class->beginsWith($videoUrl, "http://vimeo.com/") || $util_class->beginsWith($videoUrl, "http://www.vimeo.com/") || $util_class->beginsWith($videoUrl, "https://vimeo.com/")) {
154
             return true;
154
             return true;
155
         } else {
155
         } else {
156
             return false;
156
             return false;
162
         if (substr_count($videoUrl, "clip:")==1) {
162
         if (substr_count($videoUrl, "clip:")==1) {
163
             return array_pop(explode("clip:", $videoUrl));
163
             return array_pop(explode("clip:", $videoUrl));
164
         } else {
164
         } else {
165
-            return array_pop(explode("/", $videoUrl));
165
+            $videoUrl = explode("/", $videoUrl);
166
+            return array_pop($videoUrl);
166
         }
167
         }
167
     }
168
     }
168
 
169