|
2 | 2 |
|
3 | 3 | Show [specs](/spec/usage/components/video_spec.rb)
|
4 | 4 |
|
5 |
| -The HTML video tag implemented in ruby. |
| 5 | +The HTML video tag implemented in Ruby. |
6 | 6 |
|
7 | 7 | ## Parameters
|
8 |
| -The video tag takes a mandatory path argument and can take a number of optional configuration params. |
| 8 | +The video component takes mandatory path and type arguments and can take a number of optional configuration params. |
9 | 9 |
|
10 |
| -#### # path |
11 |
| -Expects a string with the source to the video. It looks for the video in the `assets/videos` folder and uses the standard Rails asset pipeline. |
| 10 | +#### # autoplay (optional) |
| 11 | +Expects a boolean and specifies whether the video should start playing as soon as it is ready. |
12 | 12 |
|
13 |
| -#### # id, class |
14 |
| -Like most of the core components, you can give a video an id and a class. |
| 13 | +#### # controls (optional) |
| 14 | +Expects a boolean and specifies whether the video controls (play/pause button etc) should be displayed. |
15 | 15 |
|
16 | 16 | #### # height (optional)
|
17 | 17 | Expects an integer with the height of the video in px.
|
18 | 18 |
|
19 |
| -#### # width (optional) |
20 |
| -Expects an integer with the width of the video in px. |
| 19 | +#### # id, class (optional) |
| 20 | +Like most of the core components, you can give a video an id and a class. |
21 | 21 |
|
22 |
| -#### # alt (optional) |
23 |
| -Expects a string with the alt text the video should have. |
| 22 | +#### # loop (optional) |
| 23 | +Expects a boolean and specifies whether the video will start over again every time it is finished. |
24 | 24 |
|
25 |
| -#### # preload |
26 |
| -Expects a string (`auto`, `metadata` or `none`) and specifies whether the whole video/only metadata/nothing should be loaded on pageload. Default (if not specified) depends on the client's browser. |
| 25 | +#### # muted (optional) |
| 26 | +Expects a boolean and specifies whether the audio output of the video should be muted. |
27 | 27 |
|
28 |
| -#### # autoplay |
29 |
| -Expects a boolean and specifies whether the video should start playing as soon as it is ready. |
| 28 | +#### # path |
| 29 | +Expects a string with the source to the video. It looks for the video in the `assets/videos` folder and uses the standard Rails asset pipeline. |
30 | 30 |
|
31 |
| -#### # muted |
32 |
| -Expects a boolean and specifies whether the audio output of the video should be muted. |
| 31 | +#### # type |
| 32 | +Expects a string with the type to the video. |
33 | 33 |
|
34 |
| -#### # playsinline |
| 34 | +#### # playsinline (optional) |
35 | 35 | Expects a boolean and specifies whether the video should be played inline on iOS Safari.
|
36 | 36 |
|
37 |
| -#### # loop |
38 |
| -Expects a boolean and specifies whether the video will start over again every time it is finished. |
| 37 | +#### # preload (optional) |
| 38 | +Expects a string (`auto`, `metadata` or `none`) and specifies whether the whole video/only metadata/nothing should be loaded on pageload. Default (if not specified) depends on the client's browser. |
39 | 39 |
|
40 |
| -#### # controls |
41 |
| -Expects a boolean and specifies whether the video controls (play/pause button etc) should be displayed. |
| 40 | +#### # width (optional) |
| 41 | +Expects an integer with the width of the video in px. |
| 42 | + |
| 43 | +## Example |
| 44 | + |
| 45 | + |
| 46 | +```ruby |
| 47 | +video path: 'corgi.mp4', type: "mp4", width: 500, height: 300 |
| 48 | +``` |
| 49 | + |
| 50 | +returns |
| 51 | + |
| 52 | +```HTML |
| 53 | +<video height='300' width='500'> |
| 54 | + <source src='/assets/corgi-[...].mp4' type='video/mp4'> |
| 55 | + Your browser does not support the video tag. |
| 56 | +</video> |
| 57 | +``` |
0 commit comments