From 1bad66913c8a967717b04fe7253175d162684f7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:21:11 +0900 Subject: [PATCH 01/42] chore(deps): bump codecov/codecov-action from 4 to 5 (MisskeyIO#819) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test-backend.yml | 4 ++-- .github/workflows/test-frontend.yml | 2 +- .github/workflows/test-misskey-js.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 2918772fa90c..a800cc71cb4c 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -74,7 +74,7 @@ jobs: - name: Test run: pnpm --filter backend test-and-coverage - name: Upload to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/backend/coverage/coverage-final.json @@ -134,7 +134,7 @@ jobs: - name: Test run: pnpm --filter backend test-and-coverage:e2e - name: Upload to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/backend/coverage/coverage-final.json diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index d186cdab7471..1157366de71a 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -54,7 +54,7 @@ jobs: - name: Test run: pnpm --filter frontend test-and-coverage - name: Upload Coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/frontend/coverage/coverage-final.json diff --git a/.github/workflows/test-misskey-js.yml b/.github/workflows/test-misskey-js.yml index 7c443037902b..4f9226a3259f 100644 --- a/.github/workflows/test-misskey-js.yml +++ b/.github/workflows/test-misskey-js.yml @@ -52,7 +52,7 @@ jobs: CI: true - name: Upload Coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/misskey-js/coverage/coverage-final.json From f4ebae395693762fe1dd7fb54e6d17a1ffd5c1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A6=E3=81=83?= =?UTF-8?q?=E3=83=BC=E3=80=82?= <56515516+mattyatea@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:06:14 +0900 Subject: [PATCH 02/42] =?UTF-8?q?enhance(Gallery):=20=E3=82=B5=E3=83=A0?= =?UTF-8?q?=E3=83=8D=E3=82=A4=E3=83=AB=E3=82=92=E3=83=9B=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=82=82=E3=81=BC=E3=81=8B=E3=81=97=E3=81=8C?= =?UTF-8?q?=E5=A4=96=E3=82=8C=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20&=20=E3=82=AE=E3=83=A3=E3=83=A9=E3=83=AA=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E8=AA=AC=E6=98=8E=E3=82=92=E4=B8=80=E7=95=AA=E4=B8=8A=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20(MisskeyIO#820)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/MkGalleryPostPreview.vue | 13 ++----------- packages/frontend/src/pages/gallery/post.vue | 10 +++++----- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/frontend/src/components/MkGalleryPostPreview.vue b/packages/frontend/src/components/MkGalleryPostPreview.vue index 47cccd9b7cf5..d6d4a7875e12 100644 --- a/packages/frontend/src/components/MkGalleryPostPreview.vue +++ b/packages/frontend/src/components/MkGalleryPostPreview.vue @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only --> @@ -82,12 +85,14 @@ import { i18n } from '@/i18n.js'; import * as os from '@/os.js'; import bytes from '@/filters/bytes.js'; import { hms } from '@/filters/hms.js'; +import MkAudioVisualizer from '@/components/MkAudioVisualizer.vue'; import MkMediaRange from '@/components/MkMediaRange.vue'; import { pleaseLogin } from '@/scripts/please-login.js'; import { $i, iAmModerator } from '@/account.js'; const props = defineProps<{ audio: Misskey.entities.DriveFile; + user?: Misskey.entities.UserLite; }>(); const keymap = { @@ -126,6 +131,7 @@ function hasFocus() { const playerEl = shallowRef(); const audioEl = shallowRef(); +const audioVisualizer = ref>(); // eslint-disable-next-line vue/no-setup-props-destructure const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore')); @@ -240,6 +246,11 @@ const isPlaying = ref(false); const isActuallyPlaying = ref(false); const elapsedTimeMs = ref(0); const durationMs = ref(0); +const audioContext = ref(null); +const sourceNode = ref(null); +const gainNode = ref(null); +const analyserGainNode = ref(null); +const analyserNode = ref(null); const rangePercent = computed({ get: () => { return (elapsedTimeMs.value / durationMs.value) || 0; @@ -262,11 +273,33 @@ const bufferedDataRatio = computed(() => { function togglePlayPause() { if (!isReady.value || !audioEl.value) return; + if (!sourceNode.value) { + audioContext.value = new (window.AudioContext || window.webkitAudioContext)(); + sourceNode.value = audioContext.value.createMediaElementSource(audioEl.value); + + analyserGainNode.value = audioContext.value.createGain(); + gainNode.value = audioContext.value.createGain(); + analyserNode.value = audioContext.value.createAnalyser(); + + sourceNode.value.connect(analyserGainNode.value); + analyserGainNode.value.connect(analyserNode.value); + analyserNode.value.connect(gainNode.value); + gainNode.value.connect(audioContext.value.destination); + + analyserNode.value.fftSize = 2048; + + analyserGainNode.value.gain.setValueAtTime(0.8, audioContext.value.currentTime); + + gainNode.value.gain.setValueAtTime(volume.value, audioContext.value.currentTime); + } + if (isPlaying.value) { audioEl.value.pause(); + audioVisualizer.value?.pauseAnimation(); isPlaying.value = false; } else { audioEl.value.play(); + audioVisualizer.value?.resumeAnimation(); isPlaying.value = true; oncePlayed.value = true; } @@ -324,6 +357,7 @@ function init() { oncePlayed.value = false; isActuallyPlaying.value = false; isPlaying.value = false; + audioVisualizer.value?.pauseAnimation(); }); durationMs.value = audioEl.value.duration * 1000; @@ -332,8 +366,7 @@ function init() { durationMs.value = audioEl.value.duration * 1000; } }); - - audioEl.value.volume = volume.value; + gainNode.value?.gain.setValueAtTime(volume.value, audioContext.value?.currentTime); } }, { immediate: true, @@ -341,7 +374,7 @@ function init() { } watch(volume, (to) => { - if (audioEl.value) audioEl.value.volume = to; + if (audioEl.value) gainNode.value?.gain.setValueAtTime(to, audioContext.value?.currentTime); }); watch(speed, (to) => { diff --git a/packages/frontend/src/components/MkMediaBanner.vue b/packages/frontend/src/components/MkMediaBanner.vue index 7a128fbad189..7eeab073c2c7 100644 --- a/packages/frontend/src/components/MkMediaBanner.vue +++ b/packages/frontend/src/components/MkMediaBanner.vue @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only