优化代码逻辑,修复潜在播放问题

This commit is contained in:
lyswhut
2023-01-14 16:03:56 +08:00
parent d3c8f16aed
commit 850a429243
35 changed files with 85 additions and 342 deletions
@@ -60,9 +60,9 @@ export default () => {
let mediaDeviceId = appSetting['player.mediaDeviceId']
const devices = await getDevices()
let device = devices.find(device => device.deviceId === mediaDeviceId)
if (!device) device = devices.find(device => device.deviceId === 'default')
device ??= devices.find(device => device.deviceId === 'default')
// @ts-expect-error
if (!device) device = { label: '', deviceId: '' }
device ??= { label: '', deviceId: '' }
// @ts-expect-error
handleDeviceChangeStopPlay(device, mediaDeviceId)