enhance: 動画・音声周りのUIと動作改良 (#12925)
* wip * (fix) `/files` をバイトレンジリクエストに対応させる * video * audio * fix * fix * spdx * fix (rangeRequest) * fix * Update CHANGELOG.md * (add) ボリュームを保存できるように * (fix) ミュート復帰時に音量が固定される * named export * tweak design * Add sensitive class for audio component * Refactor seekbar styles * Refactor hms * Revert "(add) ボリュームを保存できるように" This reverts commit 6271f9493b63f96d0dd9915207e97fe120ef9037. * Revert "(fix) ミュート復帰時に音量が固定される" This reverts commit a65002b56ecdcb10f76bcc2debbe38593a69643f. * revert revert changes --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
3d83c1aaba
commit
8b0fdfcd69
10 changed files with 1180 additions and 75 deletions
150
packages/frontend/src/components/MkMediaRange.vue
Normal file
150
packages/frontend/src/components/MkMediaRange.vue
Normal file
|
@ -0,0 +1,150 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<!-- Media系専用のinput range -->
|
||||
<template>
|
||||
<div :class="$style.controlsSeekbar" :style="sliderBgWhite ? '--sliderBg: rgba(255,255,255,.25);' : '--sliderBg: var(--scrollbarHandle);'">
|
||||
<progress v-if="buffer !== undefined" :class="$style.buffer" :value="isNaN(buffer) ? 0 : buffer" min="0" max="1">{{ Math.round(buffer * 100) }}% buffered</progress>
|
||||
<input v-model="model" :class="$style.seek" :style="`--value: ${modelValue * 100}%;`" type="range" min="0" max="1" step="any" @change="emit('dragEnded', modelValue)"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ModelRef } from 'vue';
|
||||
|
||||
withDefaults(defineProps<{
|
||||
buffer?: number;
|
||||
sliderBgWhite?: boolean;
|
||||
}>(), {
|
||||
buffer: undefined,
|
||||
sliderBgWhite: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'dragEnded', value: number): void;
|
||||
}>();
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const model = defineModel({ required: true }) as ModelRef<string | number>;
|
||||
const modelValue = computed({
|
||||
get: () => typeof model.value === 'number' ? model.value : parseFloat(model.value),
|
||||
set: v => { model.value = v; },
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.controlsSeekbar {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.seek {
|
||||
position: relative;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 26px;
|
||||
color: var(--accent);
|
||||
display: block;
|
||||
height: 19px;
|
||||
margin: 0;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
transition: box-shadow .3s ease;
|
||||
width: 100%;
|
||||
|
||||
&::-webkit-slider-runnable-track {
|
||||
background-color: var(--sliderBg);
|
||||
background-image: linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0));
|
||||
border: 0;
|
||||
border-radius: 99rem;
|
||||
height: 5px;
|
||||
transition: box-shadow .3s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
&::-moz-range-track {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 99rem;
|
||||
height: 5px;
|
||||
transition: box-shadow .3s ease;
|
||||
user-select: none;
|
||||
background-color: var(--sliderBg);
|
||||
}
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background: #fff;
|
||||
border: 0;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 1px 1px rgba(35, 40, 47, .15),0 0 0 1px rgba(35, 40, 47, .2);
|
||||
height: 13px;
|
||||
margin-top: -4px;
|
||||
position: relative;
|
||||
transition: all .2s ease;
|
||||
width: 13px;
|
||||
|
||||
&:active {
|
||||
box-shadow: 0 1px 1px rgba(35, 40, 47, .15), 0 0 0 1px rgba(35, 40, 47, .15), 0 0 0 3px rgba(255, 255, 255, .5);
|
||||
}
|
||||
}
|
||||
|
||||
&::-moz-range-thumb {
|
||||
background: #fff;
|
||||
border: 0;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 1px 1px rgba(35, 40, 47, .15),0 0 0 1px rgba(35, 40, 47, .2);
|
||||
height: 13px;
|
||||
position: relative;
|
||||
transition: all .2s ease;
|
||||
width: 13px;
|
||||
|
||||
&:active {
|
||||
box-shadow: 0 1px 1px rgba(35, 40, 47, .15), 0 0 0 1px rgba(35, 40, 47, .15), 0 0 0 3px rgba(255, 255, 255, .5);
|
||||
}
|
||||
}
|
||||
|
||||
&::-moz-range-progress {
|
||||
background: currentColor;
|
||||
border-radius: 99rem;
|
||||
height: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.buffer {
|
||||
appearance: none;
|
||||
background: transparent;
|
||||
color: var(--sliderBg);
|
||||
border: 0;
|
||||
border-radius: 99rem;
|
||||
height: 5px;
|
||||
left: 0;
|
||||
margin-top: -2.5px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
|
||||
&::-webkit-progress-bar {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&::-webkit-progress-value {
|
||||
background: currentColor;
|
||||
border-radius: 100px;
|
||||
min-width: 5px;
|
||||
transition: width .2s ease;
|
||||
}
|
||||
|
||||
&::-moz-progress-bar {
|
||||
background: currentColor;
|
||||
border-radius: 100px;
|
||||
min-width: 5px;
|
||||
transition: width .2s ease;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue