ryan

Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Just now, artaylor said:

So, I have to assume that the forum is using the plugin

This forum is just an IPBoard forum - no PW code or use of this module. Good thought though :)

Share this post


Link to post
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...

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

@strandoo Add the following on top of your .htaccess file. Perhaps this will fix the problem.

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

 

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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. 

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
3 hours ago, mel47 said:

I don't know how to apply to it since this iframe have no id neither class

I prefer the responsive embed method...

2018-03-30_101503.png.f257522cc7e412ac1c53ee55335c8f0a.png

...and this applies a class to a containing div element.

2018-03-30_101708.png.a8b15e1227e7695caa9ed894ec0c08c2.png

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, but responsive tooks too much space in desktop version, even if it's was fine in mobile version. I found a way to specify some CSS rules. Thanks.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Upgrading to which PW version? 2.x or 3.x?

Share this post


Link to post
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).

Share this post


Link to post
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...

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester