From 347c3894475865a2ca8b6661b25b463118a11c31 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Thu, 14 Apr 2022 20:01:12 +0200 Subject: [PATCH] IMPR: Vimeo video options, optional loading assets with absolute URL --- src/Extensions/EmbeddedObjectExtension.php | 62 +++++++++++----------- src/Templates/WebpackTemplateProvider.php | 28 ++++++---- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/Extensions/EmbeddedObjectExtension.php b/src/Extensions/EmbeddedObjectExtension.php index 93477c8..052251a 100755 --- a/src/Extensions/EmbeddedObjectExtension.php +++ b/src/Extensions/EmbeddedObjectExtension.php @@ -1,6 +1,5 @@ owner->getField('Controls') ? '1': '0') - ]); + $params = array_merge($params, [ + 'feature=oembed', + 'wmode=transparent', + 'enablejsapi=1', + 'disablekb=1', + 'iv_load_policy=3', + 'modestbranding=1', + 'rel=0', + 'showinfo=0', + //'controls='.($this->owner->getField('Controls') ? '1': '0') + ]); - if ($this->owner->getField('Autoplay')) { - $params[] = 'autoplay=1'; - $params[] = 'mute=1'; - } + if ($this->owner->getField('Autoplay')) { + $params[] = 'autoplay=1'; + $params[] = 'mute=1'; + } - if ($this->owner->getField('Loop')) { - $params[] = 'loop=1'; - $params[] = 'playlist=' . $videoID; - } + if ($this->owner->getField('Loop')) { + $params[] = 'loop=1'; + $params[] = 'playlist=' . $videoID; + } - $this->owner->EmbedHTML = preg_replace( - '/src="([A-z0-9:\/\.]+)\??(.*?)"/', - 'src="https://www.youtube.com/embed/' . $videoID . '?' . implode('&', $params) . '" ' - . implode(' ', $iframe_params), - $this->owner->EmbedHTML - ); + $this->owner->EmbedHTML = preg_replace( + '/src="([A-z0-9:\/\.]+)\??(.*?)"/', + 'src="https://www.youtube.com/embed/' . $videoID . '?' . implode('&', $params) . '" ' + . implode(' ', $iframe_params), + $this->owner->EmbedHTML + ); } } if (stripos($this->owner->EmbedHTML, 'https://player.vimeo.com/video/') > 0) { - $url = $this->owner->getField('SourceURL'); + $url = $this->owner->getField('SourceURL'); preg_match( '/^https:\/\/vimeo\.com\/([A-z0-9]+)/', $url, @@ -84,10 +83,9 @@ class EmbeddedObjectExtension extends DataExtension ); $videoID = $matches[1]; - $params = array_merge($params, [ - 'controls='.($this->owner->getField('Controls') ? '1': '0'), - 'background=1', - ]); + /*$params = array_merge($params, [ + 'controls='.($this->owner->getField('Controls') ? '1' : '0'), + ]);*/ if ($this->owner->getField('Autoplay')) { $params[] = 'autoplay=1'; diff --git a/src/Templates/WebpackTemplateProvider.php b/src/Templates/WebpackTemplateProvider.php index 0a77e06..b4e044a 100755 --- a/src/Templates/WebpackTemplateProvider.php +++ b/src/Templates/WebpackTemplateProvider.php @@ -1,4 +1,5 @@