Forum

Thread tagged as: Problem, Field-Types

Not showing Embedded YouTube Video

I have recently upgraded to Perch 2 to get the YouTube feature working however, it appears that Perch is simply passing the URL on the article post and not embedding the video and displaying.

Help and advice sought please...

Scott Pinhorne

Scott Pinhorne 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can you post your template please?

Hi Rachel,

As follows:

<img style="border: 0;height:1pz;"  id="midLine" alt="" src="/imgref/pixelE2DFDA.gif">
<br />
<h3><perch:content id="title" type="text" label="Event Heading" required="true" title="true" /></h3>

<p class="date"><strong>Event date: </strong><cite><perch:content id="date" type="text" label="Event Date(s)" required="true" title="true" /></cite><br />
<span class="location"><strong>Location: </strong><perch:content id="location" type="text" label="Event Location" required="true"/></span></p>

<perch:if exists="image">
<img style="margin-bottom:20px;text-align:right;" src="<perch:content type="image" id="image" label="Image" />" alt="<perch:content type="text" id="alt" label="Description" required="false" help="Description of the image for SEO e.g. Photo of MD John Smith with his best wig on" title="true" />" />

<div style="clear:both;"></div>

<perch:else />
</perch:if>

<perch:content id="video" type="youtube" label="YouTube video URL" output="embed" width="600" />

<perch:content id="body" type="textarea" label="Article body" textile="true" editor="markitup" />

    <perch:if exists="map"><h3>Map</h3>
    <p style="margin-bottom:170px;"><perch:content id="map" type="map" label="Address" width="600" height="150" zoom="5"/></p>

    <perch:else /><p> 
</perch:if></p>

<p><strong>Posted by:</strong> <perch:if exists="name">
        <perch:content id="name" type="text" label="Name" />
 <perch:else />
     Author unknown 
</perch:if></p>

<perch:content id="order" type="text" label="Display Order" required="true" title="true" suppress="true"/>
Drew McLellan

Drew McLellan 2638 points
Perch Support

I've just tested it with this exciting video about putting a bike into a box: https://www.youtube.com/watch?v=m5kldjYzGUA

Does that video work for you? (Video permissions can make a difference.)

Does your server have cURL enabled?

How Ironic! I know personally Daniel Lloyd from past cycling events!

Sadly no, changing to this video did not cure it and it is still simply just showing the URL rather than the embedded video itself.

Yes, curl is enabled on the server.

Shall we engage in a private ticket so that I can send you the client specific information for you to view?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try turning debug on first? Add the following line to your perch/config/config.php file.

define('PERCH_DEBUG', true);

And then let me know what it outputs at the bottom of the edit page after adding the YouTube URL and submitting the form?

(Daniel and the GCN team are great - love their videos!)

Daniel truly knows how to ride and to party!! #TE2013

I have just posted the part in relation to this event as there are many posts on the page.

INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (42,6,1,31,'title',''),(42,6,1,31,'date','7 April 2014'),(42,6,1,31,'location',''),(42,6,1,31,'video','https://www.youtube.com/watch?v=m5kldjYzGUA'),(42,6,1,31,'body',' '),(42,6,1,31,'body_raw','?'),(42,6,1,31,'body_processed',' '),(42,6,1,31,'order','16'),(42,6,1,31,'_id',42),(42,6,1,31,'_order','1015') OPTIMIZE TABLE perch2_content_index UPDATE perch2_pages SET pageModified='2014-06-25 12:36:09' WHERE pageID=1 SELECT * FROM perch2_content_items WHERE regionID='6' AND itemRev=31 ORDER BY itemOrder ASC

Queries: 298

Drew McLellan

Drew McLellan 2638 points
Perch Support

Daft question, but you have installed the YouTube fieldtype, right?

https://grabaperch.com/add-ons/field-types/youtube

youtube.class.php... yep!

Drew McLellan

Drew McLellan 2638 points
Perch Support

And that's at /perch/addons/fieldtypes/youtube/youtube.class.php ?

Yes, although mine is renamed from perch/ to:

Just realised mine is: cms/addons/fieldtypes/youtube.class.php

Changed to: cms/addons/fieldtypes/youtube/youtube.class.php ?

Just re-saved the page in the admin and its now working!

Drew McLellan

Drew McLellan 2638 points
Perch Support

What changed between it working and not working?

As expected, was my error...

Realised mine is: cms/addons/fieldtypes/youtube.class.php

Changed to: cms/addons/fieldtypes/youtube/youtube.class.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, gotchya. Great!

Thanks Scott. Same stupid mistake here as well. Got it fixed now :-)