This commit is contained in:
mattyatea 2024-05-16 09:20:28 +09:00
parent c13c85c8a9
commit 94bca758ab

View file

@ -101,6 +101,7 @@ import bytes from '@/filters/bytes.js';
import { hms } from '@/filters/hms.js'; import { hms } from '@/filters/hms.js';
import MkMediaRange from '@/components/MkMediaRange.vue'; import MkMediaRange from '@/components/MkMediaRange.vue';
import { $i, iAmModerator } from '@/account.js'; import { $i, iAmModerator } from '@/account.js';
import tinycolor from "tinycolor2";
const props = defineProps<{ const props = defineProps<{
audio: Misskey.entities.DriveFile; audio: Misskey.entities.DriveFile;
}>(); }>();
@ -243,6 +244,7 @@ const volume = ref(.25);
const speed = ref(1); const speed = ref(1);
const loop = ref(false); // TODO: const loop = ref(false); // TODO:
const bufferedEnd = ref(0); const bufferedEnd = ref(0);
let audioContext = new AudioContext();
// MediaControl Events // MediaControl Events
function togglePlayPause() { function togglePlayPause() {
@ -273,7 +275,8 @@ let stopAudioElWatch: () => void;
function init() { function init() {
if (onceInit) return; if (onceInit) return;
onceInit = true; onceInit = true;
const computedStyle = getComputedStyle(document.documentElement);
accent.value = tinycolor(computedStyle.getPropertyValue('--accent')).toHexString();
stopAudioElWatch = watch(audioEl, () => { stopAudioElWatch = watch(audioEl, () => {
if (audioEl.value) { if (audioEl.value) {
isReady.value = true; isReady.value = true;
@ -339,8 +342,6 @@ watch(loop, (to) => {
}); });
onMounted(async () => { onMounted(async () => {
accent.value = tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--accent'));
init(); init();
}); });