Jump to content

Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)


ryan

Recommended Posts

4 minutes ago, artaylor said:

@strandoo Not sure if this would help, but I notice you are using the short form url on the second example (that does not work) of https://youtu.be/LBY12usmYAA, have you tried using the actual youtube url (which I cannot link to here because it embeds the video)?

 

I haven't tested, but youtube.be should work: https://github.com/ryancramerdesign/TextformatterVideoEmbed/blob/7c8e4ddce22dc4970c17d0f63ce3d53679e7e3a8/TextformatterVideoEmbed.module#L163

Here's it working as expected:
https://regex101.com/r/aEcLl2/1

  • Like 1
Link to comment
Share on other sites

@adrian You are likely correct. I did not do any real testing. However, as an interesting note, when I posted my previous message you can see the url to youtu.be as a url, however, the link to the video using youtube.com actually embedded the video. So, I have to assume that the forum is using the plugin and it did not show the shortened version.

Link to comment
Share on other sites

@artaylor I've tried different URLs with similar results. I just tested the embed URL and that didn't work. And as @adrian pointed out, but short form does work (on the 'good' site). I checked other text formatters to make sure they didn't conflict. One thing I just thought of is that they are served from different hosting companies (StableHost vs HostingUK) so differing server configs could be in play...

Link to comment
Share on other sites

2 hours ago, strandoo said:

The other only works if it's a Vimeo video; YouTube URLs slow the page loading then only displays the URL.

The strange thing is though is that you have working embedded YouTube videos on that site here:

http://www.burstoncrown.com/events/easy-thursdays/jess-morgan-and-kitty-macfarlane/

Perhaps the host is running mod_security or similar and that is being triggered by particular patterns in some video URLs?

Link to comment
Share on other sites

3 hours ago, strandoo said:

Hi all. This has been driving me nuts: I've used this module previously and it worked perfectly. I've got it on 2 sites, but music-related. One works normally; I use the textformatter on the body text and videos display fine. The other only works if it's a Vimeo video; YouTube URLs slow the page loading then only displays the URL. I've tried a number of tests and different URLs and I can't figure this out. Both sites are not new and I'm pretty sure that it used to work where now it doesn't.

Here are two samples (they are past gigs, so I can play around with them without messing up the live sites):

Works: https://waveneyvalleyfolkcollective.co.uk/events/kirsty-merryn-jack-harris/

Doesn't Work: http://www.burstoncrown.com/events/sunday-sessions/falling-from-trees/

Any suggestions?

I've seen something similar to this on a client site when this textformatter was added to a CKEditor'd textarea field. It turned out that I was pasting in links to the video, not just the plaintext of the video address and this was causing the formatter to fail to match and then embed it. If you look at the source of the page where the video doesn't work, look to see if the text you pasted is actually a link, and if so, simply break the link, save the page and revisit it on the front-end.

I hope that is what's happening here - but there's no guarantee it is.

Link to comment
Share on other sites

I tried inserting this link and it works here. There is something that makes text formater to fail and then just plain text is rendered. As netcarver pointed, remove the link to video altogether, save the page and the insert it again. Also, the site sometimes takes a long time to load at all, but its unrelated I guess.

Link to comment
Share on other sites

10 hours ago, Robin S said:

The strange thing is though is that you have working embedded YouTube videos on that site here:

http://www.burstoncrown.com/events/easy-thursdays/jess-morgan-and-kitty-macfarlane/

Ah, I should have mentioned that. Since this is alive site, and that's an upcoming gig, I needed a workaround. I'm not using the module there, just a special field that inserts the YouTube URL in an iframe. I prefer the responsiveness of Ryan's module.

@netcarver  I've run into that problem in the past, so I've checked. All clean text. 

@PWaddict That sound promising. I've had problems with mod_security before. I'll try it out a bit later today. 

Last night I created a local version of the site and the videos loaded fine, leading me to think it's a hosting/php/config thing. 

Link to comment
Share on other sites

2 minutes ago, strandoo said:

@PWaddict That sound promising. I've had problems with mod_security before. I'll try it out a bit later today. 

Last night I created a local version of the site and the videos loaded fine, leading me to think it's a hosting/php/config thing. 

Then I'm 99.9% sure that the mod_security is causing the problem. The suggested fix will do the job.

Link to comment
Share on other sites

So, as PWaddict predicted, turning off mod_security did the trick, but I couldn't do it with the htaccess rule. I tried that first, but it didn't do anything, so I disabled it in the Plesk control panel. (It's under 'Web Application Firewall..'; I've set it to 'detection only' rather than 'on' or 'off'. If anyone knows of a downside to this or if I can target something more directly, please let me know). But the video now appears as it should. Thanks all.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Update: a couple of days later, the problem returned. I contacted support for this account and after a bit of back and forth, I gave up. I took a look at the hosting Plesk cp and saw that mod_sec is turned off. The PHP version was 5.3 (I'm pretty sure I had it at 5.6) so I changed it back to 5.6. I'm basically back where I started. Maybe I'll move the account to my reseller hosting. Everything works fine there...

Link to comment
Share on other sites

  • 3 months later...

Hi

How do I center the video? If it's embed in <p>link<p>, it's display. But if we do <p style="text-align:center;">link</p>, the video doesn't display.

I just have 2 formatters, this one and Hanna.

Thanks

 

Link to comment
Share on other sites

Hello,

Found a solution via css, but I don't know how to apply to it since this iframe have no id neither class. (I have others iframe which I doesn't want to center).

So how I can apply an id or class to the video iframe?

Thanks

Link to comment
Share on other sites

  • 1 month later...

I'm in process of upgrading PW 2.5.4, PHP 5.6.8 and using TextformatterVideoEmbed version 109. When I upgrade this module to the latest version 111 I get 

Compile Error: Cannot make static method ConfigurableModule::getModuleConfigInputfields() non static in
class TextformatterVideoEmbed (line 18 of \site\modules\TextformatterVideoEmbed\TextformatterVideoEmbed.module) 

Is it possible that this method is problematic?

version 109:

public static function getModuleConfigInputfields(array $data) {

version 111:

public function getModuleConfigInputfields(array $data) {

 

  • Like 1
Link to comment
Share on other sites

My plan is to go slow: 2.5.4 -> 2.7.3 -> 2.8.62 -> 3.0.102 But it fails on 2.5.4. The module itself states it's stable and working on 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0 I know the module v 111 works on PW 3 (various versions).

Link to comment
Share on other sites

I have upgraded several old (~4 yrs) PW sites straight to the latest dev version. The more you wait with upgrading, the more you'll have to change. Sometimes it just means adding PW namespaces, or upgrading modules as well. Sadly, I have no clue why this function causes problems. I just came across Ryan's announcement of this function: https://processwire.com/blog/posts/new-module-configuration-options/

This was introduced for 2.5.5. Maybe @ryan can shed some light on this...

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...