aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-20 20:52:13 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-20 20:52:13 +0200
commit1e4613aa1113b373a8d841c28e222599237a33c5 (patch)
treed307a10051d6e504366e76a71c17cba7deda47ac /templates
parent64603aa1e13ba82b9393b9eb91b6332237f45821 (diff)
downloadlens-1e4613aa1113b373a8d841c28e222599237a33c5.tar.gz
lens-1e4613aa1113b373a8d841c28e222599237a33c5.tar.bz2
lens-1e4613aa1113b373a8d841c28e222599237a33c5.zip
feat: Add option to preload metadata
Let the use pick if they want to preload videos' metadata.
Diffstat (limited to 'templates')
-rw-r--r--templates/media.qtpl14
-rw-r--r--templates/settings.qtpl8
2 files changed, 19 insertions, 3 deletions
diff --git a/templates/media.qtpl b/templates/media.qtpl
index 18eac0d..6217899 100644
--- a/templates/media.qtpl
+++ b/templates/media.qtpl
@@ -2,8 +2,16 @@
{% code
type MediaPage struct {
- Medias []*repository.Media
- Next *repository.Pagination
+ Medias []*repository.Media
+ Next *repository.Pagination
+ Settings *repository.Settings
+}
+
+func (m *MediaPage) PreloadAttr() string {
+ if m.Settings.PreloadVideoMetadata {
+ return "metadata"
+ }
+ return "none"
}
%}
@@ -14,7 +22,7 @@ type MediaPage struct {
{% for _, media := range p.Medias %}
<div class="card-image">
{% if media.IsVideo() %}
- <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="metadata">
+ <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="{%s p.PreloadAttr() %}">
<source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
</video>
{% else %}
diff --git a/templates/settings.qtpl b/templates/settings.qtpl
index 509cddd..6eee1ab 100644
--- a/templates/settings.qtpl
+++ b/templates/settings.qtpl
@@ -30,6 +30,14 @@ type SettingsPage struct {
</div>
</div>
<div class="field">
+ <div class="control">
+ <label class="checkbox">
+ <input type="checkbox" id="preloadVideoMetadata" name="preloadVideoMetadata" {% if p.Settings.PreloadVideoMetadata %}checked{% endif %}>
+ Preload video metadata
+ </label>
+ </div>
+ </div>
+ <div class="field">
<input class="button" value="save" type="submit">
</div>
</form>