|
1 | 1 | {% assign video_url = include.src %}
|
| 2 | +{% assign title = include.title %} |
2 | 3 | {% assign poster_url = include.poster %}
|
| 4 | +{% assign types = include.types | default: '' | strip | split: '|' %} |
3 | 5 |
|
4 | 6 | {% unless video_url contains '://' %}
|
5 | 7 | {%- capture video_url -%}
|
6 |
| - {% include img-url.html src=video_url img_path=page.img_path %} |
| 8 | + {% include media-url.html src=video_url %} |
7 | 9 | {%- endcapture -%}
|
8 | 10 | {% endunless %}
|
9 | 11 |
|
10 | 12 | {% if poster_url %}
|
11 | 13 | {% unless poster_url contains '://' %}
|
12 | 14 | {%- capture poster_url -%}
|
13 |
| - {% include img-url.html src=poster_url img_path=page.img_path %} |
| 15 | + {% include media-url.html src=poster_url subpath=page.media_subpath %} |
14 | 16 | {%- endcapture -%}
|
15 | 17 | {% endunless %}
|
16 | 18 | {% assign poster = 'poster="' | append: poster_url | append: '"' %}
|
|
31 | 33 | {% endif %}
|
32 | 34 |
|
33 | 35 | <p>
|
34 |
| - <video class="embed-video file" src="{{ video_url }}" {{ poster }} {{ attributes }}> |
35 |
| - Your browser doesn't support HTML video. Here is a <a href="{{ video_url }}">link to the video</a> instead. |
| 36 | + <video class="embed-video file" {{ poster }} {{ attributes }}> |
| 37 | + {% assign extension = video_url | split: '.' | last %} |
| 38 | + {% assign types = extension | concat: types %} |
| 39 | + |
| 40 | + {% assign ext_size = extension | size %} |
| 41 | + {% assign src_size = video_url | size %} |
| 42 | + {% assign slice_size = src_size | minus: ext_size %} |
| 43 | + |
| 44 | + {% assign filepath = video_url | slice: 0, slice_size %} |
| 45 | + |
| 46 | + {% for type in types %} |
| 47 | + {% assign src = filepath | append: type %} |
| 48 | + {% assign media_item = site.data.media | find: 'extension', type %} |
| 49 | + {% assign mime_type = media_item.mime_type | default: type %} |
| 50 | + <source src="{{ src }}" type="video/{{ mime_type }}"> |
| 51 | + {% endfor %} |
| 52 | + |
| 53 | + Your browser does not support the video tag. Here is a |
| 54 | + <a href="{{ video_url | strip }}">link to the video file</a> instead. |
36 | 55 | </video>
|
37 |
| - <em>{{ include.title }}</em> |
| 56 | + {% if title %} |
| 57 | + <em>{{ title }}</em> |
| 58 | + {% endif %} |
38 | 59 | </p>
|
0 commit comments