|
| 1 | +# matestack core component: Youtube |
| 2 | + |
| 3 | +Show [specs](../../spec/usage/components/youtube_spec.rb) |
| 4 | + |
| 5 | +A youtube video, embedded into an `iFrame` HTML tag. |
| 6 | + |
| 7 | +## Parameters |
| 8 | +The video tag takes mandatory *youtube id*, *height* and *width* arguments and can take a number of optional configuration params. |
| 9 | + |
| 10 | +#### # yt_id |
| 11 | +Expects a string with the id to the youtube video you want to embed. |
| 12 | + |
| 13 | +#### # id, class (optional) |
| 14 | +Like most of the core components, you can give a video an id and a class. |
| 15 | + |
| 16 | +#### # height |
| 17 | +Expects an integer with the height of the iFrame in px. |
| 18 | + |
| 19 | +#### # width |
| 20 | +Expects an integer with the width of the iFrame in px. |
| 21 | + |
| 22 | +#### # no_controls (optional) |
| 23 | +Expects a boolean. If set to true, no controls will be displayed with the embedded youtube video. |
| 24 | + |
| 25 | +#### # privacy_mode (optional) |
| 26 | +Expects a boolean. If set to true, the video gets loaded from 'www.youtube-nocookie.com' instead of the default 'www.youtube.com'. |
| 27 | + |
| 28 | +#### # start_at (optional) |
| 29 | +Expects an integer that indicates at what second the video should start. |
| 30 | + |
| 31 | +## Example 1 |
| 32 | + |
| 33 | +```ruby |
| 34 | +youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I' |
| 35 | +``` |
| 36 | + |
| 37 | +gets rendered into |
| 38 | + |
| 39 | +```HTML |
| 40 | +<iframe allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen='' frameborder='0' height='360' src='https://www.youtube.com/embed/OY5AeGhgK7I' width='360'></iframe> |
| 41 | +``` |
| 42 | + |
| 43 | +## Example 2 |
| 44 | + |
| 45 | +```ruby |
| 46 | +youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I', start_at: 30, no_controls: true |
| 47 | +youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I', start_at: 30, privacy_mode: true |
| 48 | +``` |
| 49 | + |
| 50 | +gets rendered into |
| 51 | + |
| 52 | +```HTML |
| 53 | +<iframe allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen='' frameborder='0' height='360' src='https://www.youtube.com/embed/OY5AeGhgK7I?controls=0&start=30' width='360'></iframe> |
| 54 | +<iframe allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen='' frameborder='0' height='360' src='https://www.youtube-nocookie.com/embed/OY5AeGhgK7I?start=30' width='360'></iframe> |
| 55 | +``` |
0 commit comments