Video
Important information:
This component requires documentation.
YouTube video
<div class="ons-video">
<iframe title="Census 2021 promotional TV advert" class="ons-video__iframe" src="https://www.youtube.com/embed/_EGJlvkgbPo" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{% from "components/video/_macro.njk" import onsVideo %}
{{
onsVideo({
"youtubeUrl": "https://www.youtube.com/embed/_EGJlvkgbPo",
"title": "Census 2021 promotional TV advert"
})
}}
{%- macro onsVideo(params) -%}
<div class="ons-video">
{% if params.youtubeUrl is defined and params.youtubeUrl %}
<iframe title="{{ params.title }}" class="ons-video__iframe" src="{{ params.youtubeUrl }}" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{% endif %}
</div>
{%- endmacro -%}
.ons-video {
@extend .ons-u-mb-m;
height: 0;
padding-bottom: 56.25%; /* 16:9 */
position: relative;
&__iframe {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
}
Help improve this component
Let us know how we could improve this component or share your user research findings. Discuss the ‘Video’ component on GitHub