From 790d540655dac4b337e46df56560c98fd7ff4e3e Mon Sep 17 00:00:00 2001 From: nokhnaton Date: Sun, 27 Oct 2024 20:02:25 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9F=E3=83=A5=E3=83=BC=E3=83=88=E7=8A=B6?= =?UTF-8?q?=E6=85=8B=E3=82=92=E4=BF=9D=E6=8C=81=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/app/rtc.ts | 9 ++++----- src/store/app/rtcSettings.ts | 12 ++++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/store/app/rtc.ts b/src/store/app/rtc.ts index e6bf4b053..2a5302e0c 100644 --- a/src/store/app/rtc.ts +++ b/src/store/app/rtc.ts @@ -46,16 +46,15 @@ const useAppRtcPinia = defineStore('app/rtc', () => { } /** マイクミュート */ - const isMicMuted = ref(false) const muteLocalStream = () => { if (!localStreamManager.value) return localStreamManager.value.mute() - isMicMuted.value = true + rtcSettings.isMute.value = true } const unmuteLocalStream = () => { if (!localStreamManager.value) return localStreamManager.value.unmute() - isMicMuted.value = false + rtcSettings.isMute.value = false } /** 現在発話しているユーザーを判定するsetIntervalのID */ @@ -283,7 +282,7 @@ const useAppRtcPinia = defineStore('app/rtc', () => { setUserVolume(userId, 0.5) }) - if (isMicMuted.value) { + if (rtcSettings.isMute.value) { mute() } else { unmute() @@ -352,7 +351,7 @@ const useAppRtcPinia = defineStore('app/rtc', () => { return { isCurrentDevice, - isMicMuted, + isMicMuted: rtcSettings.isMute, talkingUsersState, startQall, endQall, diff --git a/src/store/app/rtcSettings.ts b/src/store/app/rtcSettings.ts index 0b1d7cca4..ced6a3227 100644 --- a/src/store/app/rtcSettings.ts +++ b/src/store/app/rtcSettings.ts @@ -19,6 +19,7 @@ type State = { voicePitch: number voiceRate: number voiceVolume: number + isMute: boolean } const useRtcSettingsPinia = defineStore('app/rtcSettings', () => { @@ -33,12 +34,13 @@ const useRtcSettingsPinia = defineStore('app/rtcSettings', () => { voiceName: '', voicePitch: 1, voiceRate: 1.2, - voiceVolume: 1 + voiceVolume: 1, + isMute: false } const [state, restoring, restoringPromise] = useIndexedDbValue( 'store/app/rtcSettings', - 2, + 3, { // migrate from vuex 1: async getStore => { @@ -64,6 +66,12 @@ const useRtcSettingsPinia = defineStore('app/rtcSettings', () => { delete state?.isNoiseReductionEnabled const setReq = store.put(state, key) await promisifyRequest(setReq) + }, + + 3: async getStore => { + const store = getStore() + const setReq = store.put({ isMute: false }, key) + await promisifyRequest(setReq) } }, initialValue