From ce2b5187fc55b9839e3c1ed90f81a99d83e1d8b7 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 1 Oct 2021 16:12:12 +0000 Subject: [PATCH] wait #4737 @0.5 --- inc/ws/Metier/class.ws.book.parametres.php | 3 +- .../html5/master/class.ws.html5.links.php | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 7ff4d7276..24aa5c28e 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -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'), 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 adabd7e1c..e167ed025 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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' => [ -- 2.39.5