mute videos automatically #201

This commit is contained in:
teddit
2021-06-01 23:17:06 +02:00
parent 224db4ff6a
commit 9da48f92c5
4 changed files with 48 additions and 11 deletions
+10 -2
View File
@@ -37,6 +37,14 @@ html
max-height: #{user_preferences.post_media_max_height}px;
max-width: 100%;
}
-
let video_muted = false
if(instance_videos_muted === true || user_preferences.videos_muted === 'true') {
video_muted = true
}
if(user_preferences.videos_muted === 'false') {
video_muted = false
}
.info
.score
div.arrow
@@ -113,7 +121,7 @@ html
p #{post.media.embed_src}
else
.video
video(controls="controls", autoplay="autoplay", loop="loop")
video(controls="controls", autoplay="autoplay", loop="loop", muted=(video_muted ? true : false))
source(src="" + post.media.source + "", type="video/mp4")
| Your browser does not support the video element.
a(href="" + post.media.source + "") [media]
@@ -168,7 +176,7 @@ html
p #{post.media.embed_src}
else
.video
video(controls="controls", autoplay="autoplay", loop="loop")
video(controls="controls", autoplay="autoplay", loop="loop", muted=(video_muted ? true : false))
source(src="" + post.media.source + "", type="video/mp4")
| Your browser does not support the video element.
a(href="" + post.media.source + "") [media]
+15
View File
@@ -96,6 +96,21 @@ html
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage", checked="checked")
else
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage")
legend Media
.setting
label(for="videos_muted") Mute videos by default:
-
let videos_muted = false
if(instance_config.videos_muted === true || user_preferences.videos_muted === 'true') {
videos_muted = true
}
if(user_preferences.videos_muted === 'false') {
videos_muted = false
}
if(videos_muted)
input(type="checkbox", name="videos_muted", id="videos_muted", checked="checked")
else
input(type="checkbox", name="videos_muted", id="videos_muted")
small(class="notice") Preferences are stored client-side using cookies without any personal information.
br
input(type="submit", value="Save preferences")