-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for embed video files (#1558)
- Loading branch information
Showing
5 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
<iframe | ||
class="embed-video bilibili" | ||
class="embed-video" | ||
loading="lazy" | ||
src="https://player.bilibili.com/player.html?bvid={{ include.id }}" | ||
scrolling="no" | ||
border="0" | ||
frameborder="no" | ||
frameborder="0" | ||
framespacing="0" | ||
allowfullscreen="true" | ||
></iframe> | ||
></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% assign video_url = include.src %} | ||
{% assign poster_url = include.poster %} | ||
|
||
{% unless video_url contains '://' %} | ||
{%- capture video_url -%} | ||
{% include img-url.html src=video_url img_path=page.img_path %} | ||
{%- endcapture -%} | ||
{% endunless %} | ||
|
||
{% if poster_url %} | ||
{% unless poster_url contains '://' %} | ||
{%- capture poster_url -%} | ||
{% include img-url.html src=poster_url img_path=page.img_path %} | ||
{%- endcapture -%} | ||
{% endunless %} | ||
{% assign poster = 'poster="' | append: poster_url | append: '"' %} | ||
{% endif %} | ||
|
||
{% assign attributes = 'controls' %} | ||
|
||
{% if include.autoplay %} | ||
{% assign attributes = attributes | append: ' ' | append: 'autoplay' %} | ||
{% endif %} | ||
|
||
{% if include.loop %} | ||
{% assign attributes = attributes | append: ' ' | append: 'loop' %} | ||
{% endif %} | ||
|
||
{% if include.muted %} | ||
{% assign attributes = attributes | append: ' ' | append: 'muted' %} | ||
{% endif %} | ||
|
||
<p> | ||
<video class="embed-video file" src="{{ video_url }}" {{ poster }} {{ attributes }}> | ||
Your browser doesn't support HTML video. Here is a <a href="{{ url }}">link to the video</a> instead. | ||
</video> | ||
<em>{{ include.title }}</em> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters