diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/media.qtpl | 14 | ||||
-rw-r--r-- | templates/settings.qtpl | 8 |
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> |