]> _ Git - cubeextranet.git/commitdiff
wait #4737 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Oct 2021 16:12:12 +0000 (16:12 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Oct 2021 16:12:12 +0000 (16:12 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 7ff4d7276471e13d20b1a329189b06bb71680b59..24aa5c28ec5f0b494f6f534708106f06ac718706 100644 (file)
@@ -557,12 +557,13 @@ class wsBookParametres extends wsParametres
         $this->forms['slideshow'] = ['label' => __('Slideshow'),
             'fieldsnames' => ['inlineSlideshowLibrary', 'popupSlideshowLibrary', '|', 'slideshowCaptionSize', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration']];
 
+        $this->fields['webvideoAsLocal'] = ['type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Intégrer les webvidéos en local')];
         $this->fields['mobileVideosPath'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Chemin vers les vidéos'), 'grade' => 5);
         $this->fields['brightcovePlayerId'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Brightcove Player Id'), 'grade' => 3);
         $this->fields['brightcovePlayerSecret'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Brightcove Player Secret'), 'grade' => 3);
         $this->fields['bigPlayImage'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Image pour le bouton "Big Play"'), 'grade' => 3, 'fileFilter' => $imageExtraFilter];
         $this->forms['videos'] = array('label' => __('Vidéos'),
-            'fieldsnames' => array('mobileVideosPath', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'bigPlayImage'));
+            'fieldsnames' => array('webvideoAsLocal', '|', 'mobileVideosPath', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'bigPlayImage'));
         //.
         $this->fields['audioPlayerTheme'] = ['type' => 'combo', 'default' => 'native', 'editable' => true, 'label' => __('Apparence du lecteur audio'), 'datas' => [__('Apparence native du navigateur') => 'native', __('Zone cliquable invisible') => 'invisible', __('Red Bull') => 'redbull']];
         $this->forms['audio'] = ['label' => __('Lecteur audio'),
index adabd7e1c8a8613d621c7d37fc97cc004096e384..e167ed02554e10f629908a9344780b011a7a7ce6 100644 (file)
@@ -75,6 +75,35 @@ class wsHTML5Link
         $init['scorm'] = self::isScorm($init);
         $init['to'] = self::replaceCustomURL($init['to']);
 
+        if ($init['type'] == 10 && $compiler->book->parametres->webvideoAsLocal) {
+            switch ($init['video_service']) {
+                case 0:
+                    $url = 'https://www.youtube.com/watch?v=' . $init['to'];
+                    break;
+                case 1:
+                    $url = 'https://www.dailymotion.com/video/' . $init['to'];
+                    break;
+                case 2:
+                    $url = 'https://www.vimeo.com/' . $init['to'];
+                    break;
+                default:
+                    break;
+            }
+            if (isset($url)) {
+                $fname = commonTools::_youtubedl($url);
+                $file = '/data/extranet/www/cache/youtubedl/' . $fname;
+            }
+            if (isset($file) && file_exists($file)) {
+                $init['type'] = 4;
+                $init['to'] = $fname;
+                $init['video_sound_on'] = true;
+                $init['video_controls'] = true;
+                copy($file, $compiler->wdir . $fname);
+            }
+
+
+        }
+
         switch ($init['type']) {
             case 1:
             case 2:
@@ -1344,6 +1373,7 @@ class audioPopupLink extends normalLink
 class webVideoLink extends videoLink
 {
 
+
     public static function getVideoAttributes($data, $w = null, $h = null, $compiler = null)
     {
         $attributes = parent::getVideoAttributes($data, $w, $h, $compiler);
@@ -1379,6 +1409,7 @@ class webVideoLink extends videoLink
                 // 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');
+                //$compiler->addJs('https://rawgit.com/benjipott/video.js-dailymotion/master/dist-test/videojs-dailymotion.js');
                 $setup = [
                     //                    'techOrder' => ['dailymotion'],
                     //                    'sources' => [