enhance(frontend): make default volume of video 30%

This commit is contained in:
syuilo 2023-10-08 14:01:40 +09:00
parent f37a3eff79
commit 774bf6a55e
4 changed files with 17 additions and 14 deletions

View file

@ -14,6 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div v-else :class="[$style.visible, (video.isSensitive && defaultStore.state.highlightSensitiveMedia) && $style.sensitiveContainer]">
<video
ref="videoEl"
:class="$style.video"
:poster="video.thumbnailUrl"
:title="video.comment"
@ -31,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { ref, shallowRef, watch } from 'vue';
import * as Misskey from 'misskey-js';
import bytes from '@/filters/bytes.js';
import { defaultStore } from '@/store.js';
@ -42,6 +43,14 @@ const props = defineProps<{
}>();
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.enableDataSaverMode) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore'));
const videoEl = shallowRef<HTMLVideoElement>();
watch(videoEl, () => {
if (videoEl.value) {
videoEl.value.volume = 0.3;
}
});
</script>
<style lang="scss" module>