Skip to content

Instantly share code, notes, and snippets.

@TimShi
Last active March 4, 2022 21:02
Show Gist options
  • Save TimShi/a48fa83abbc8a0242557 to your computer and use it in GitHub Desktop.
Save TimShi/a48fa83abbc8a0242557 to your computer and use it in GitHub Desktop.
Using s3video Jekyll Plugin
module Jekyll
class ResponsiveS3VideoTag < Liquid::Tag
def initialize(tag_name, markup, options)
super
@video_source = markup.strip
end
def render(context)
%Q[
<div class="embed-responsive embed-responsive-16by9">
<video id="video" controls poster="#{@video_source}/thumbnail/thumbnail_00001.png">
<source src="#{@video_source}/webm" type="video/webm">
<source src="#{@video_source}/hls.m3u8">
Your browser does not support the <code>video</code> element.
</video>
</div>
]
end
end
end
Liquid::Template.register_tag("s3video", Jekyll::ResponsiveS3VideoTag)

Embed Responsive S3_Video On Jekyll Site

  1. Use S3_Video to publish your video on AWS S3.
  2. Add bootstrap css to your Jekyll site.
  3. Place the plugin for S3Video in your Jekyll site's _plugins directory
  4. Now you can use the following markdown in your Jekyll pages to embed the video. Replace your-s3-video-id-here with your own stream ID.
{% s3video your-s3-video-id-here %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment