Jump to content

mackoch

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by mackoch

  1. Hi Ryan Some Vimeo videos are - probably due to the video settings - addressed with a double video ID, see for example https://vimeo.com/375900955/606ffc53b1. However, the TextformatterVideoEmbed module only supports video URLs with a single video ID. I have solved the problem for our customer with the following provisional change in the module code: protected function embedVimeo(&$str) { if(strpos($str, '://vimeo.com/') === false) return; // original module code // works only with one video id e.g. https://vimeo.com/150348620 //if(!preg_match_all('#<p>\s*(https?://vimeo.com/(\d+)).*?</p>#', $str, $matches)) return; // new module code // works with single and double video id e.g. https://vimeo.com/150348620 and https://vimeo.com/375900955/606ffc53b1 if(!preg_match_all('#<p>\s*(https?://vimeo.com/(\d+)/?([a-z0-9]+)?)</p>#', $str, $matches)) return; foreach($matches[0] as $key => $line) { $oembedURL = "$this->http://vimeo.com/api/oembed.json?url=" . urlencode($matches[1][$key]) . "&maxwidth={$this->maxWidth}&maxheight={$this->maxHeight}"; $videoID = $matches[2][$key]; // additional modul code (adds second video id, if exists) if(isset($matches[3][$key]) && $matches[3][$key] != '') $videoID .= '/'.$matches[3][$key]; $embedCode = $this->getEmbedCode($oembedURL, $videoID); if($this->responsive) $embedCode = $this->makeResponsive($embedCode); if($embedCode) $str = str_replace($line, $embedCode, $str); } } I would be grateful if you, Ryan, could solve the problem with the double Vimeo Video ID in case of a module upgrade. NOTE: I replaced my code 2020-01-13. The code posted 2020-01-07 only worked in my particular environment. Sorry!
×
×
  • Create New...