jekyll-mux 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +96 -0
- data/lib/jekyll/mux_tag.rb +65 -0
- data/lib/jekyll-mux.rb +3 -0
- metadata +66 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4c92af4f41242241a305d73ebe260383750428cae16c6278c30a37fd6e2c7f92
|
|
4
|
+
data.tar.gz: fa63bcade901f7801cc2851d2086e945c5aa2f3c868f0546106db7e60a33f614
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7cf44c1b07b7fbfa547fcbe37eca93729447a7d9aec253a866c9297c78bf60f6ae2e2161ea412e5d69c763d8620d40d244c2e4029699230b4adb0dad717def15
|
|
7
|
+
data.tar.gz: a7cbc132bbe2d1ce15e06247f7ee086bb2f734206c31bc09f8bb1b42a581b34d5ff38a1ea4435a156cd3e26bea227152558e020c911be0fdd124012864bc8eab
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-08-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Initial release
|
|
7
|
+
- `{% mux PLAYBACK_ID %}` Liquid tag for embedding Mux-hosted videos
|
|
8
|
+
- Responsive 16:9 iframe wrapper with class `mux-embed`
|
|
9
|
+
- Support for Mux Player embed parameters: `accent-color`, `autoplay`, `loop`, `muted`, `playsinline`, `preload`, `metadata-*`, `stream-type`, `start-time`
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jason Chance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# jekyll-mux
|
|
2
|
+
|
|
3
|
+
A Jekyll plugin that provides a `{% mux %}` Liquid tag for embedding [Mux](https://mux.com)-hosted videos with a responsive iframe wrapper.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add to your `Gemfile`:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem "jekyll-mux", "~> 0.1"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add to your `_config.yml`:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
plugins:
|
|
17
|
+
- jekyll-mux
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then run:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
bundle install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```liquid
|
|
29
|
+
{% mux YOUR_PLAYBACK_ID %}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
With optional parameters:
|
|
33
|
+
|
|
34
|
+
```liquid
|
|
35
|
+
{% mux YOUR_PLAYBACK_ID accent-color=#ff0000 autoplay=false loop=false muted=false %}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
With metadata for Mux Data analytics:
|
|
39
|
+
|
|
40
|
+
```liquid
|
|
41
|
+
{% mux YOUR_PLAYBACK_ID metadata-video-title="My Video" metadata-viewer-user-id=user-123 %}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The tag outputs a responsive 16:9 iframe wrapper:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<div class="mux-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
48
|
+
<iframe
|
|
49
|
+
src="https://player.mux.com/YOUR_PLAYBACK_ID"
|
|
50
|
+
frameborder="0"
|
|
51
|
+
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture"
|
|
52
|
+
allowfullscreen
|
|
53
|
+
style="position:absolute;top:0;left:0;width:100%;height:100%;"
|
|
54
|
+
loading="lazy">
|
|
55
|
+
</iframe>
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Finding Your Playback ID
|
|
60
|
+
|
|
61
|
+
Your Mux playback ID is the alphanumeric string in your Mux dashboard video URL or from the Mux API. It's the value that goes after `https://player.mux.com/` in an embed URL.
|
|
62
|
+
|
|
63
|
+
## Supported Parameters
|
|
64
|
+
|
|
65
|
+
| Parameter | Values | Description |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `accent-color` | CSS color value | Player accent color (default: Mux pink `#fa50b5`) |
|
|
68
|
+
| `autoplay` | `true`, `false` | Autoplay the video on load |
|
|
69
|
+
| `loop` | `true`, `false` | Loop playback |
|
|
70
|
+
| `muted` | `true`, `false` | Start muted |
|
|
71
|
+
| `playsinline` | `true`, `false` | Play inline on mobile (no forced fullscreen) |
|
|
72
|
+
| `preload` | `auto`, `metadata`, `none` | Preload behavior |
|
|
73
|
+
| `stream-type` | `on-demand`, `live` | Video stream type |
|
|
74
|
+
| `start-time` | number (seconds) | Start playback at this time |
|
|
75
|
+
| `metadata-video-id` | string | Custom video ID for Mux Data |
|
|
76
|
+
| `metadata-video-title` | string | Video title for Mux Data |
|
|
77
|
+
| `metadata-viewer-user-id` | string | Viewer ID for Mux Data |
|
|
78
|
+
| `metadata-player-name` | string | Player name for Mux Data |
|
|
79
|
+
| `metadata-page-type` | string | Page type for Mux Data |
|
|
80
|
+
| `metadata-sub-property-id` | string | Sub-property ID for Mux Data |
|
|
81
|
+
|
|
82
|
+
Parameters with spaces in values should be quoted: `metadata-video-title="My Great Video"`.
|
|
83
|
+
|
|
84
|
+
## Styling
|
|
85
|
+
|
|
86
|
+
The plugin outputs an unstyled `.mux-embed` wrapper div. Add bottom margin or other spacing in your site's CSS:
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
.mux-embed {
|
|
90
|
+
margin-bottom: 2rem;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT — see [LICENSE.txt](LICENSE.txt).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "cgi"
|
|
4
|
+
require "liquid"
|
|
5
|
+
|
|
6
|
+
module Jekyll
|
|
7
|
+
class MuxTag < Liquid::Tag
|
|
8
|
+
EMBED_BASE = "https://player.mux.com/"
|
|
9
|
+
|
|
10
|
+
# Supported query parameters for the Mux iframe embed player.
|
|
11
|
+
# These mirror the Mux Player web component attributes as URL query params.
|
|
12
|
+
VALID_PARAMS = %w[
|
|
13
|
+
accent-color autoplay loop muted playsinline preload
|
|
14
|
+
metadata-video-id metadata-video-title metadata-viewer-user-id
|
|
15
|
+
metadata-player-name metadata-page-type metadata-sub-property-id
|
|
16
|
+
stream-type start-time
|
|
17
|
+
].freeze
|
|
18
|
+
|
|
19
|
+
def initialize(tag_name, markup, tokens)
|
|
20
|
+
super
|
|
21
|
+
parts = markup.strip.split(/\s+/, 2)
|
|
22
|
+
@playback_id = parts[0]
|
|
23
|
+
@params = parse_params(parts[1] || "")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def render(_context)
|
|
27
|
+
raise "Mux tag requires a playback ID" if @playback_id.nil? || @playback_id.strip.empty?
|
|
28
|
+
|
|
29
|
+
src = EMBED_BASE + @playback_id
|
|
30
|
+
unless @params.empty?
|
|
31
|
+
src += "?" + @params.map { |k, v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}" }.join("&")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
<<~HTML.strip
|
|
35
|
+
<div class="mux-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
36
|
+
<iframe
|
|
37
|
+
src="#{src}"
|
|
38
|
+
frameborder="0"
|
|
39
|
+
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture"
|
|
40
|
+
allowfullscreen
|
|
41
|
+
style="position:absolute;top:0;left:0;width:100%;height:100%;"
|
|
42
|
+
loading="lazy">
|
|
43
|
+
</iframe>
|
|
44
|
+
</div>
|
|
45
|
+
HTML
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def parse_params(raw)
|
|
51
|
+
params = {}
|
|
52
|
+
raw.scan(/(\S+?)=(?:"([^"]*?)"|'([^']*?)'|(\S+))/) do |key, dq, sq, bare|
|
|
53
|
+
value = dq || sq || bare
|
|
54
|
+
if VALID_PARAMS.include?(key)
|
|
55
|
+
params[key] = value
|
|
56
|
+
else
|
|
57
|
+
warn "jekyll-mux: Unknown param '#{key}' ignored"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
params
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Liquid::Template.register_tag("mux", Jekyll::MuxTag)
|
data/lib/jekyll-mux.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll-mux
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jason Chance
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-08-20 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: jekyll
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '4.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '4.0'
|
|
26
|
+
description: jekyll-mux provides a simple {% mux PLAYBACK_ID %} Liquid tag for embedding
|
|
27
|
+
Mux-hosted videos with a responsive iframe wrapper and support for Mux Player embed
|
|
28
|
+
parameters.
|
|
29
|
+
email:
|
|
30
|
+
- jason@jasonchance.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- CHANGELOG.md
|
|
36
|
+
- LICENSE.txt
|
|
37
|
+
- README.md
|
|
38
|
+
- lib/jekyll-mux.rb
|
|
39
|
+
- lib/jekyll/mux_tag.rb
|
|
40
|
+
homepage: https://jasonchance.com/projects/jekyll-mux/
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: https://jasonchance.com/projects/jekyll-mux/
|
|
45
|
+
source_code_uri: https://github.com/jchance/jekyll-mux
|
|
46
|
+
bug_tracker_uri: https://github.com/jchance/jekyll-mux/issues
|
|
47
|
+
changelog_uri: https://github.com/jchance/jekyll-mux/blob/main/CHANGELOG.md
|
|
48
|
+
rdoc_options: []
|
|
49
|
+
require_paths:
|
|
50
|
+
- lib
|
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '3.0'
|
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
requirements: []
|
|
62
|
+
rubygems_version: 3.6.2
|
|
63
|
+
specification_version: 4
|
|
64
|
+
summary: A Jekyll plugin that provides a {% mux %} Liquid tag for embedding Mux-hosted
|
|
65
|
+
videos.
|
|
66
|
+
test_files: []
|