diff --git a/packages/frontend/src/components/MkMediaAudio.vue b/packages/frontend/src/components/MkMediaAudio.vue
index bfeb60cc1b..ef02fa01ae 100644
--- a/packages/frontend/src/components/MkMediaAudio.vue
+++ b/packages/frontend/src/components/MkMediaAudio.vue
@@ -46,6 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{
if (!audioEl.value) return 0;
@@ -167,6 +168,13 @@ function toggleMute() {
}
}
+function saveVolume(newVolume: number) {
+ defaultStore.set('mediaPlayer', {
+ ...defaultStore.state.mediaPlayer,
+ volume: newVolume,
+ });
+}
+
let onceInit = false;
let stopAudioElWatch: () => void;
@@ -207,7 +215,7 @@ function init() {
isActuallyPlaying.value = false;
isPlaying.value = false;
});
-
+
durationMs.value = audioEl.value.duration * 1000;
audioEl.value.addEventListener('durationchange', () => {
if (audioEl.value) {
diff --git a/packages/frontend/src/components/MkMediaRange.vue b/packages/frontend/src/components/MkMediaRange.vue
index e40947fe20..5f1b848b02 100644
--- a/packages/frontend/src/components/MkMediaRange.vue
+++ b/packages/frontend/src/components/MkMediaRange.vue
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only
@@ -22,6 +22,10 @@ withDefaults(defineProps<{
sliderBgWhite: false,
});
+const emit = defineEmits<{
+ (ev: 'dragEnded', value: number): void;
+}>();
+
// eslint-disable-next-line no-undef
const model = defineModel({ required: true }) as ModelRef;
const modelValue = computed({
diff --git a/packages/frontend/src/components/MkMediaVideo.vue b/packages/frontend/src/components/MkMediaVideo.vue
index f08114fdd3..12c822eac1 100644
--- a/packages/frontend/src/components/MkMediaVideo.vue
+++ b/packages/frontend/src/components/MkMediaVideo.vue
@@ -69,6 +69,7 @@ SPDX-License-Identifier: AGPL-3.0-only
v-model="volume"
:sliderBgWhite="true"
:class="$style.volumeSeekbar"
+ @dragEnded="saveVolume"
/>
{
if (!videoEl.value) return 0;
@@ -242,6 +243,13 @@ function toggleMute() {
}
}
+function saveVolume(newVolume: number) {
+ defaultStore.set('mediaPlayer', {
+ ...defaultStore.state.mediaPlayer,
+ volume: newVolume,
+ });
+}
+
let onceInit = false;
let stopVideoElWatch: () => void;
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index e3a85377d8..ecb81b83dc 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -427,6 +427,12 @@ export const defaultStore = markRaw(new Storage('base', {
sfxVolume: 1,
},
},
+ mediaPlayer: {
+ where: 'device',
+ default: {
+ volume: 0.5,
+ },
+ },
sound_masterVolume: {
where: 'device',