Forum
Using fieldtype "Youtube" together with "fancybox" (lightbox)
Hi,
I am trying to use the YouTube-fieldtype together with fancybox-js. I want to show the thumbnail-image, when clicked, get the video in a lightbox, like this: https://fancyapps.com/fancybox/ (look for the link: "Youtube (iframe)").
I'm almost there, but I need to get a URL with this syntax "https://www.youtube.com/embed/L9szn1QQfas?autoplay=1" from the fieldtype).
So I hoped the fieldtype had an output called "ID", that would just give me "L9szn1QQfas". But I can only see "url" and "embed" as possible outputs. https://docs.grabaperch.com/addons/field-types/youtube/
Has this been requested before?
The page I am working on is this: https://comeshine.granqvist.no/videos (work in progress)
Hi,
You could do this without the youtube fieldtype, and just have the user enter the video ID rather than the whole URL. So something like:
Not sure how the code needs to be structured for the lightbox but does this look ok? The
/0.jpg
links to the full size image for the video. There are other options you could use here, I can't remember them but I am pretty sure there is1.jpg
-4.jpg
and adefault.jpg
at leastHi, great info. I didn't know about the image-trick:
But I kind of like getting all the meta-data to display together with the video, so I would really like to use the fieldtype.
Hmm in that case you might need to use PHP to use some find/replace to extract the ID from the URL.... though someone else may have a better idea!
I found out that I could fetch the ID by using "youtubeID" (undocumented):
That would be
output="id"
as well.