Jump to content

Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)


ryan

Recommended Posts

I already have 109 and it's working. So, jumping straight ahead to 3.x? Will try and report back, probably on Sunday.  Thx dragan & horst.

I upgraded PW from 2.5.4 to 3.0.104 and then php from 5.5.12 to 7.2.2 in one go. Everything went fine. I needed DynamicRoles module that is compatible with PW3. 

Edited by matjazp
Update
  • Like 2
Link to comment
Share on other sites

On 5/15/2018 at 10:40 PM, tires said:

Is there a way to use the youtube nocookie url like https://www.youtube-nocookie.com/embed/XYZ123

The module does not support this, but you could edit the module file, adding the following line here:

$embedCode = str_replace('youtube.com', 'youtube-nocookie.com', $embedCode);

If you later update the module the change would be overwritten and you would have to redo it.

  • Like 2
Link to comment
Share on other sites

8 hours ago, Robin S said:

The module does not support this, but you could edit the module file, adding the following line here:


$embedCode = str_replace('youtube.com', 'youtube-nocookie.com', $embedCode);

If you later update the module the change would be overwritten and you would have to redo it.

Thanks a lot Robin, you saved my day!!!!

Link to comment
Share on other sites

9 hours ago, Robin S said:

The module does not support this, but you could edit the module file, adding the following line here:


$embedCode = str_replace('youtube.com', 'youtube-nocookie.com', $embedCode);

If you later update the module the change would be overwritten and you would have to redo it.

I did the same for the TextformatterVideoEmbed module. Also added an option to it, if you want to use the nocookie domain or not.

  • Like 1
Link to comment
Share on other sites

2 hours ago, jmartsch said:

I did the same for the TextformatterVideoEmbed module. Also added an option to it, if you want to use the nocookie domain or not.

Couldn't you add this option into the module?
Would be great!

Link to comment
Share on other sites

22 hours ago, tires said:

Couldn't you add this option into the module?
Would be great!

I am planning to make a PR on github the next few days, in the meantime you could download my version of the module, as soon as I release it on github. Will notify you here.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hey,

 

I would like to use this module as well but when I use it the whole website slows extremely down. It doesn't work. On my colleguage's system it works as charme. He uses v  3.0.62 and I use v  3.0.98. I really need this module to work. Any ideas? We compared the settings on both systems / backends and they're the same. Any ideas? I would appreciate it.

Link to comment
Share on other sites

39 minutes ago, Marcel said:

Hey,

 

I would like to use this module as well but when I use it the whole website slows extremely down. It doesn't work. On my colleguage's system it works as charme. He uses v  3.0.62 and I use v  3.0.98. I really need this module to work. Any ideas? We compared the settings on both systems / backends and they're the same. Any ideas? I would appreciate it.

Are you both on the same web host?   What other third-parry Process modules are you using? Please tell us more about your web environment.  That will provide critical information for someone to help you.

Link to comment
Share on other sites

15 minutes ago, cstevensjr said:

Are you both on the same web host?   What other third-parry Process modules are you using? Please tell us more about your web environment.  That will provide critical information for someone to help you.

No, we are on seperates ones. On modules there are Process, Protected and Textformatter. As soon as I go to Fields>myfield>Details>Text Formatters>Video embed for YT/Vimeo even the backend is immediately super slow or doesn't even react. 

Link to comment
Share on other sites

19 hours ago, Marcel said:

As soon as I go to Fields>myfield>Details>Text Formatters>Video embed for YT/Vimeo even the backend is immediately super slow or doesn't even react. 

That is strange, because Textformatters are only active on the frontend and not in the backend (far as I know). I never experienced a real slowdown with this module active and in use. Maybe it has something to do with your database access, because the module caches the embed code in the database.

The module also works with multilanguage fields, as I am using it for that purpose on https://p-jentschura.com

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Hey !

I added the module and am trying to implement it into my body field but it doesn't work for youtube videos. I tried with a vimeo link and it's perfect but not with youtube.

I unlinked, I tried the no-cookie stuff into the module code and now I'm getting crazy ! Any hint ?

cheers !

Link to comment
Share on other sites

  • 1 month later...

I'm trying to use Text formatter in conjunction with the multiplier pro module using a text field but it doesn't work. Does anyone have any thoughts of why that is or might be at all?

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...
  • 1 month later...

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!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...