forked from mirror/misskey
revert original media components
This commit is contained in:
parent
302b5ac953
commit
794cbbce57
@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
:class="$style.nativeAudio"
|
:class="$style.nativeAudio"
|
||||||
@keydown.prevent
|
@keydown.prevent
|
||||||
>
|
>
|
||||||
<source :src="audio.url" :type="audio.type">
|
<source :src="audio.url">
|
||||||
</audio>
|
</audio>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -39,10 +39,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<audio
|
<audio
|
||||||
ref="audioEl"
|
ref="audioEl"
|
||||||
preload="metadata"
|
preload="metadata"
|
||||||
tabindex="-1"
|
@keydown.prevent="() => {}"
|
||||||
@keydown.prevent
|
|
||||||
>
|
>
|
||||||
<source :src="audio.url" :type="audio.type">
|
<source :src="audio.url">
|
||||||
</audio>
|
</audio>
|
||||||
<div :class="[$style.controlsChild, $style.controlsLeft]">
|
<div :class="[$style.controlsChild, $style.controlsLeft]">
|
||||||
<button
|
<button
|
||||||
@ -89,7 +88,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { shallowRef, watch, computed, ref, inject, onDeactivated, onActivated, onMounted } from 'vue';
|
import { shallowRef, watch, computed, ref, onDeactivated, onActivated, onMounted } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import type { MenuItem } from '@/types/menu.js';
|
import type { MenuItem } from '@/types/menu.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
@ -105,13 +104,10 @@ const props = defineProps<{
|
|||||||
audio: Misskey.entities.DriveFile;
|
audio: Misskey.entities.DriveFile;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
|
|
||||||
|
|
||||||
const keymap = {
|
const keymap = {
|
||||||
'up': {
|
'up': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && audioEl.value) {
|
if (hasFocus() && audioEl.value) {
|
||||||
volume.value = Math.min(volume.value + 0.1, 1);
|
volume.value = Math.min(volume.value + 0.1, 1);
|
||||||
}
|
}
|
||||||
@ -120,7 +116,6 @@ const keymap = {
|
|||||||
'down': {
|
'down': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && audioEl.value) {
|
if (hasFocus() && audioEl.value) {
|
||||||
volume.value = Math.max(volume.value - 0.1, 0);
|
volume.value = Math.max(volume.value - 0.1, 0);
|
||||||
}
|
}
|
||||||
@ -129,7 +124,6 @@ const keymap = {
|
|||||||
'left': {
|
'left': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && audioEl.value) {
|
if (hasFocus() && audioEl.value) {
|
||||||
audioEl.value.currentTime = Math.max(audioEl.value.currentTime - 5, 0);
|
audioEl.value.currentTime = Math.max(audioEl.value.currentTime - 5, 0);
|
||||||
}
|
}
|
||||||
@ -138,14 +132,12 @@ const keymap = {
|
|||||||
'right': {
|
'right': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && audioEl.value) {
|
if (hasFocus() && audioEl.value) {
|
||||||
audioEl.value.currentTime = Math.min(audioEl.value.currentTime + 5, audioEl.value.duration);
|
audioEl.value.currentTime = Math.min(audioEl.value.currentTime + 5, audioEl.value.duration);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'space': () => {
|
'space': () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
togglePlayPause();
|
togglePlayPause();
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
title: image.name,
|
title: image.name,
|
||||||
class: $style.imageContainer,
|
class: $style.imageContainer,
|
||||||
href: image.url,
|
href: image.url,
|
||||||
target: '_blank',
|
|
||||||
rel: 'noopener',
|
|
||||||
style: 'cursor: zoom-in;'
|
style: 'cursor: zoom-in;'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
@ -37,7 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
controls
|
controls
|
||||||
@keydown.prevent
|
@keydown.prevent
|
||||||
>
|
>
|
||||||
<source :src="video.url" :type="video.type">
|
<source :src="video.url">
|
||||||
</video>
|
</video>
|
||||||
<i class="ti ti-eye-off" :class="$style.hide" @click="hide = true"></i>
|
<i class="ti ti-eye-off" :class="$style.hide" @click="hide = true"></i>
|
||||||
<div :class="$style.indicators">
|
<div :class="$style.indicators">
|
||||||
@ -53,13 +53,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
:poster="video.thumbnailUrl ?? undefined"
|
:poster="video.thumbnailUrl ?? undefined"
|
||||||
:title="video.comment ?? undefined"
|
:title="video.comment ?? undefined"
|
||||||
:alt="video.comment"
|
:alt="video.comment"
|
||||||
tabindex="-1"
|
|
||||||
preload="metadata"
|
preload="metadata"
|
||||||
playsinline
|
playsinline
|
||||||
@keydown.prevent
|
@keydown.prevent
|
||||||
@click.self="togglePlayPause"
|
@click.self="togglePlayPause"
|
||||||
>
|
>
|
||||||
<source :src="video.url" :type="video.type">
|
<source :src="video.url">
|
||||||
</video>
|
</video>
|
||||||
<button v-if="isReady && !isPlaying" class="_button" :class="$style.videoOverlayPlayButton" @click="togglePlayPause"><i class="ti ti-player-play-filled"></i></button>
|
<button v-if="isReady && !isPlaying" class="_button" :class="$style.videoOverlayPlayButton" @click="togglePlayPause"><i class="ti ti-player-play-filled"></i></button>
|
||||||
<div v-else-if="!isActuallyPlaying" :class="$style.videoLoading">
|
<div v-else-if="!isActuallyPlaying" :class="$style.videoLoading">
|
||||||
@ -110,7 +109,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, shallowRef, computed, watch, inject, onDeactivated, onActivated, onMounted } from 'vue';
|
import { ref, shallowRef, computed, watch, onDeactivated, onActivated, onMounted } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import type { MenuItem } from '@/types/menu.js';
|
import type { MenuItem } from '@/types/menu.js';
|
||||||
import { type Keymap } from '@/scripts/hotkey.js';
|
import { type Keymap } from '@/scripts/hotkey.js';
|
||||||
@ -128,13 +127,10 @@ const props = defineProps<{
|
|||||||
video: Misskey.entities.DriveFile;
|
video: Misskey.entities.DriveFile;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
|
|
||||||
|
|
||||||
const keymap = {
|
const keymap = {
|
||||||
'up': {
|
'up': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && videoEl.value) {
|
if (hasFocus() && videoEl.value) {
|
||||||
volume.value = Math.min(volume.value + 0.1, 1);
|
volume.value = Math.min(volume.value + 0.1, 1);
|
||||||
}
|
}
|
||||||
@ -143,7 +139,6 @@ const keymap = {
|
|||||||
'down': {
|
'down': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && videoEl.value) {
|
if (hasFocus() && videoEl.value) {
|
||||||
volume.value = Math.max(volume.value - 0.1, 0);
|
volume.value = Math.max(volume.value - 0.1, 0);
|
||||||
}
|
}
|
||||||
@ -152,7 +147,6 @@ const keymap = {
|
|||||||
'left': {
|
'left': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && videoEl.value) {
|
if (hasFocus() && videoEl.value) {
|
||||||
videoEl.value.currentTime = Math.max(videoEl.value.currentTime - 5, 0);
|
videoEl.value.currentTime = Math.max(videoEl.value.currentTime - 5, 0);
|
||||||
}
|
}
|
||||||
@ -161,14 +155,12 @@ const keymap = {
|
|||||||
'right': {
|
'right': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus() && videoEl.value) {
|
if (hasFocus() && videoEl.value) {
|
||||||
videoEl.value.currentTime = Math.min(videoEl.value.currentTime + 5, videoEl.value.duration);
|
videoEl.value.currentTime = Math.min(videoEl.value.currentTime + 5, videoEl.value.duration);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'space': () => {
|
'space': () => {
|
||||||
if (inEmbedPage) return;
|
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
togglePlayPause();
|
togglePlayPause();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user