1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-26 14:24:40 +02:00

Merge remote-tracking branch 'msky/improve-image-viewer' into improve-image-viewer-1

This commit is contained in:
kakkokari-gtyih
2026-07-11 18:34:58 +09:00

View File

@@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ref, computed, watch, onActivated, onMounted } from 'vue';
import { ref, computed, watch, onActivated, onMounted, onBeforeUnmount } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import { hms } from '@/filters/hms.js';
import { i18n } from '@/i18n.js';
@@ -110,7 +110,7 @@ function showMenu(ev: PointerEvent) {
// MediaControl: Common State
const oncePlayed = ref(false);
const isReady = ref(false);
const isPlaying = ref(true);
const isPlaying = ref(false);
const isActuallyPlaying = ref(false);
const elapsedTimeMs = ref(0);
const durationMs = ref(0);
@@ -161,7 +161,6 @@ function toggleMute() {
let onceInit = false;
let mediaTickFrameId: number | null = null;
let stopVideoElWatch: () => void;
function init() {
if (onceInit) return;
@@ -181,6 +180,11 @@ function init() {
if (props.videoEl.loop !== loop.value) {
loop.value = props.videoEl.loop;
}
if (props.videoEl.paused !== !isPlaying.value) {
isPlaying.value = !props.videoEl.paused;
}
mediaTickFrameId = window.requestAnimationFrame(updateMediaTick);
}
@@ -235,6 +239,12 @@ onActivated(() => {
init();
});
onBeforeUnmount(() => {
if (mediaTickFrameId != null) {
window.cancelAnimationFrame(mediaTickFrameId);
}
});
</script>
<style lang="scss" module>