Forum

Thread tagged as: Question, Problem

YouTube fieldtype only outputs the video URL

Hi Guys,

I have jsut tried using the new YouTube fieldtype and having followed my docs, my template looks like this;

<div class="video">
<perch:content id="video" type="youtube" label="YouTube URL" output="embed" width="400" height="200" />
<perch:content id="video" type="youtube" label="YouTube URL" output="title" />
<perch:content id="video" type="youtube" label="YouTube URL" output="description" />
<perch:content id="video" type="youtube" label="YouTube URL" output="date" />
</div>

I am just playing to see what I can do. But after the initial embed works and outputs the video. None of the other outputs seem to work, instead each one just outputs the URL of the video (e.g https://www.youtube.com/watch?v=umIAsqqk8L8)

Also I noticed if you only specify a width then the video also doesn't show, it needs both width and height, but not sure how this will work if the videos from YouTube are different aspect rations as this could squeeze or stretch. I would expect a width only to keep the height aspect ration, like with images.

Any ideas on both these points?

Thanks, Terry

Terry Upton

Terry Upton 0 points

  • 6 years ago

Hi Terry

Regarding the video size try removing your width and height settings from the video and add this style to your stylesheet should work (you can customise margins etc as needed).


.video { margin: 0; padding: 0; text-align: center; position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; background: #fff; } .video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is output="player" any better?

I tried this as I saw it from another thread. But to didn't seem to work either? I didn't even get the video with this option, it just retuned the URL again.

Neil Irwin said:

Hi Terry

Regarding the video size try removing your width and height settings from the video and add this style to your stylesheet should work (you can customise margins etc as needed).


.video { margin: 0; padding: 0; text-align: center; position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; background: #fff; } .video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

Neil - thanks for this. I will give this a test too.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you on a Windows server?

Nope. On Mac (OSX) but also tried it on live server (Linux/Centos)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the video a public one?

Yes it is. It is this one. https://www.youtube.com/watch?v=umIAsqqk8L8

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm, ok. This is the second similar report I've had, but as yet I can't reproduce the issue.

If you want access to the draft site on the server then let me know. If it helps to see anything?

I had a similar issues, but with only one specific video. It turned out that it contained copyright-protected content. The specific error message was: "This video contains content from SME. It is restricted from playback on certain sites."

Terry, does your video contain copyright-protected content?

There is no copyrighted content I am aware of (it is a clients video). But I have tried with a few videos and the same issue occurs. Even videos from other YouTube users.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'll keep trying to reproduce it, but I'm a bit at a loss until that point.

I'm having the same problem - running EasyPHP on Windows. Yet to test on live server.

All I get it the youtube URL when I try to use other output options.

I'm having same problem on live site... Any updates?

Hi Guys,

Any updates on this at all?

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, it's not something we can reproduce.

What is the likely cause of this not working so I can see if I can add something to make it work? Sometimes missing in server setup/php?

I had to just resort to a custom/manual solution. Far from ideal but not having the thumbnail load was an unacceptable solution for the client :(

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you can give me enough information to reproduce it, I can try again.

Happy to liaise Drew. What details or information do you want or would help? Not doing anything different except using it as per the docs - so thinking possible something server-side missing or required? Would a PHP info file be of any use?