YouTube Video
The YouTube Video field allows you to output a YouTube Video player in your content. A YouTube Video field requires only the URL of the YouTube video's page.
The way that it works is by taking a URL of the YouTube page that the video is on and then parsing it and giving you the information to easily embed it on a page or link to it to open in a lightbox.
The attribute can be configured to control auto play, full screen, video sizing, and more.
Example Data
The YouTube Video tag contains a variety of information to display or use the YouTube video on a page.
Below is the example data for https://www.youtube.com/watch?v=P7kR-dZR2Tc.
Array
(
[autoplay] => 0
[fs] => 0
[height] => 360
[iframeEmbed] => Array
(
[allowfullscreen] => allowfullscreen
[frameborder] => 0
[height] => 360
[src] => https://www.youtube.com/embed/P7kR-dZR2Tc?fs=0&rel=1&autoplay=0&loop=0&showsearch=1&showinfo=1
[tag] => <iframe height="360" width="480" src="https://www.youtube.com/embed/P7kR-dZR2Tc?fs=0&rel=1&autoplay=0&loop=0&showsearch=1&showinfo=1" frameborder="0" allowfullscreen></iframe>
[width] => 480
)
[iframeUrlRaw] => https://www.youtube.com/embed/P7kR-dZR2Tc
[loop] => 0
[rel] => 1
[showinfo] => 1
[showsearch] => 1
[size] => medium-large
[url] => https://www.youtube.com/watch?v=P7kR-dZR2Tc
[videoId] => P7kR-dZR2Tc
[width] => 480
)
The data on this page is for sites using the Twig template engine. If your site is still using the legacy BranchCode template engine then you will have different data.
Below is a description of each value.
If the tags have a value of "0" or "1" then "0" means 'false' or 'no' and "1" means 'true' or 'yes'.
Tag | Description |
---|---|
autoplay | Whether or not the video should autoplay. Values are "0" or "1". |
fs | Holds whether or not the fullscreen button in the video should show. Values: "0" or "1" |
height | Holds the height of the video. Example: 144 |
iframeEmbed | The full iframe data to embed the video on the page. It is an Iframe HTML Object. |
iframeUrlRaw | The embed URL that doesn't contain any of the URL parameters. |
loop | Holds whether or not the video should automatically start over when it's completed. Values: "0" or "1" |
rel | Holds whether or not the player should show related videos when the video ends. Values: "0" or "1" |
showinfo |
Holds whether or not the player will display information like the video title and uploader before the video starts playing. Values: "0" or "1"
|
showsearch | Holds whether or not to show the search box when the video is minimized. Note that if the "rel" value is set to "0" then that will also force the search box to not be shown. Values: "0" or "1" |
size | Holds a descriptive name for the size of the video. Example:high-small |
url | Holds the URL to view the video on YouTube. Example: http://www.youtube.com/watch?v=j_uY02Wevvc |
videoId | Holds the YouTube video id. Example: j_uY02Wevvc |
width | Holds the width of the video. Example: 176 |