添加音频可视化与音频输出设备冲突的提示

This commit is contained in:
lyswhut
2022-03-08 14:51:29 +08:00
parent 6253368f05
commit 05f6a953ea
8 changed files with 60 additions and 6 deletions
+3
View File
@@ -115,6 +115,9 @@ export default {
watch(() => setting.value.player.togglePlayMethod, val => {
currentStting.value.player.togglePlayMethod = val
})
watch(() => setting.value.player.audioVisualization, val => {
currentStting.value.player.audioVisualization = val
})
},
data() {
return {
@@ -18,18 +18,21 @@ dd
dd(:tips="$t('setting__play_mediaDevice_title')")
h3#play_mediaDevice {{$t('setting__play_mediaDevice')}}
div
base-selection.gap-left(:list="mediaDevices" v-model="currentStting.player.mediaDeviceId" item-key="deviceId" item-name="label")
base-selection.gap-left(:list="mediaDevices" v-model="mediaDeviceId" @change="handleMediaDeviceIdChnage" item-key="deviceId" item-name="label")
</template>
<script>
import { ref, onBeforeUnmount, watch, nextTick } from '@renderer/utils/vueTools'
import { ref, onBeforeUnmount, watch, nextTick, useI18n } from '@renderer/utils/vueTools'
import { setTaskBarProgress } from '@renderer/utils/tools'
import { dialog } from '@renderer/plugins/Dialog'
import { currentStting } from '../setting'
export default {
name: 'SettingPlay',
setup() {
const { t } = useI18n()
const mediaDevices = ref([])
const getMediaDevice = async() => {
const devices = await navigator.mediaDevices.enumerateDevices()
@@ -51,10 +54,28 @@ export default {
})
})
const mediaDeviceId = ref(currentStting.value.player.mediaDeviceId)
const handleMediaDeviceIdChnage = async() => {
if (currentStting.value.player.audioVisualization) {
await dialog({
message: t('setting__play_media_device_tip'),
confirmButtonText: t('alert_button_text'),
})
mediaDeviceId.value = currentStting.value.player.mediaDeviceId
} else {
currentStting.value.player.mediaDeviceId = mediaDeviceId.value
}
}
watch(() => currentStting.value.player.mediaDeviceId, val => {
mediaDeviceId.value = val
})
return {
currentStting,
mediaDevices,
mediaDeviceId,
handleMediaDeviceIdChnage,
}
},
}
+8 -2
View File
@@ -2,14 +2,20 @@ import { ref } from '@renderer/utils/vueTools'
export const currentStting = ref({
player: {
togglePlayMethod: 'random',
togglePlayMethod: 'listLoop',
highQuality: false,
isShowTaskProgess: true,
volume: 1,
isMute: false,
mediaDeviceId: 'default',
isMediaDeviceRemovedStopPlay: false,
isShowLyricTranslation: false,
isS2t: false, // 是否将歌词从简体转换为繁体
isPlayLxlrc: true,
isSavePlayTime: false,
audioVisualization: false,
waitPlayEndStop: true,
waitPlayEndStopTime: 0,
waitPlayEndStopTime: '',
},
playDetail: {
isZoomActiveLrc: true,