Comments (3)
oh never mind, i figured it out
{{ if not (.Page.Scratch.Get "plyrLoaded") }}
{{ .Page.Scratch.Set "plyrLoaded" true }}
<link rel="stylesheet" href="https://cdn.plyr.io/3.6.8/plyr.css" />
<script src="https://cdn.plyr.io/3.6.8/plyr.polyfilled.js"></script>
<script>
window.onload = function() {
const players = Plyr.setup('#player');
};
</script>
{{ end }}
<video id="player" playsinline controls>
<source src="{{ .Get 0 }}" type="video/mp4" />
</video>
from hugo-video.
Thanks for your feedback. I know videojs
, but it's out of scope of this project, intended to support video without additional code.
from hugo-video.
Can you explain me how to create my own theme component? There is no much documentation in the web. https://gohugo.io/hugo-modules/theme-components/
I'm creating shortcut like this, but there I shouldn't include css and js file each time it's used, there is .HasShortcode option, but it only works in templates, but when i'm trying to use template it just overrides theme completely.
<link rel="stylesheet" href="https://cdn.plyr.io/3.6.8/plyr.css" />
<video id="player" playsinline controls>
<source src="{{ .Get 0 }}" type="video/mp4" />
</video>
<script src="https://cdn.plyr.io/3.6.8/plyr.polyfilled.js"></script>
<script>const players = Plyr.setup('.js-player');
</script>
I switched to plyr because it's looking nicer, there is one theme that uses it https://github.com/funkydan2/alpha-church/, i see js included in layouts/partials/scripts.html and css in layouts/partials/header.html
from hugo-video.
Related Issues (16)
- .MediaType.Suffixes returns empty array for m4v when site is deployed to GitLab HOT 1
- Use `static` as source for videos? HOT 4
- Video extension m4v is not supported HOT 6
- width attribute doesn't function HOT 2
- height attribute not supported
- Video doesn't autoplay on iOS devices HOT 6
- Could not use http link in video. HOT 1
- Message "Your browser doesn't support embedded videos" displays when quoting video HOT 2
- the module works, but no movie HOT 6
- Page Bundle HOT 3
- Wrong download link when using shortcode multiple times on same page HOT 4
- Link in error message not correctly parsed HOT 2
- File with unsupported extension displays a video with no content HOT 2
- Shortcode breaks when file not found HOT 1
- Where video files must be? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo-video.