修复某些情况下可能导致的音源输出问题
parent
eff49af00c
commit
685e34bc83
|
@ -6,3 +6,4 @@
|
|||
|
||||
- 修复按住`Ctrl`等键触发多选机制时不松开按键的情况下切换到其他窗口后再松开按键,这时切回软件不按按键都处在多选模式的问题
|
||||
- 修复Linux版开启托盘无法退出的问题
|
||||
- 修复某些情况下可能导致的音源输出问题
|
||||
|
|
|
@ -617,12 +617,12 @@ export default {
|
|||
},
|
||||
async setMediaDevice() {
|
||||
let mediaDeviceId = this.setting.player.mediaDeviceId
|
||||
if (!mediaDeviceId) return
|
||||
const devices = await navigator.mediaDevices.enumerateDevices()
|
||||
let device = devices.find(device => device.deviceId === mediaDeviceId)
|
||||
if (!device) return this.setMediaDeviceId('default')
|
||||
const deviceId = device ? device.deviceId : 'default'
|
||||
|
||||
// console.log(device)
|
||||
this.audio.setSinkId(device.deviceId).catch((err) => {
|
||||
this.audio.setSinkId(deviceId).catch(err => {
|
||||
console.log(err)
|
||||
this.setMediaDeviceId('default')
|
||||
})
|
||||
|
|
|
@ -614,7 +614,9 @@ export default {
|
|||
},
|
||||
async getMediaDevice() {
|
||||
const devices = await navigator.mediaDevices.enumerateDevices()
|
||||
const audioDevices = devices.filter(device => device.kind === 'audiooutput')
|
||||
let audioDevices = devices.filter(device => device.kind === 'audiooutput')
|
||||
let currentId = this.current_setting.player.mediaDeviceId
|
||||
if (!audioDevices.some(device => device.deviceId === currentId)) this.current_setting.player.mediaDeviceId = 'default'
|
||||
this.mediaDevices = audioDevices
|
||||
// console.log(this.mediaDevices)
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue