fix: ajout error handling pour getDefault audio devices

- Try/catch dans getDefaultInputDevice et getDefaultOutputDevice
- Cherche d'abord device avec isDefault.input/output = true
- Fallback sur premier device avec canaux disponibles
- Retourne null en cas d'erreur au lieu de crash
This commit is contained in:
2026-05-26 15:30:20 +02:00
parent 6a9ee05114
commit 2338562b4f
4 changed files with 37 additions and 16 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ define(['./workbox-290dd570'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.u6ufl8c15b8"
"revision": "0.u556t341pt8"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
File diff suppressed because one or more lines are too long
@@ -140,8 +140,17 @@ export class CoreAudioBackend extends EventEmitter {
* @returns {Object|null} Device d'entrée par défaut
*/
static getDefaultInputDevice() {
try {
const devices = this.getDevices();
// Chercher d'abord le device marqué comme default
const defaultDevice = devices.find(d => d.isDefault?.input && d.maxInputChannels > 0);
if (defaultDevice) return defaultDevice;
// Fallback: premier device avec input
return devices.find(d => d.maxInputChannels > 0) || null;
} catch (error) {
console.error('Erreur getDefaultInputDevice:', error);
return null;
}
}
/**
@@ -149,8 +158,17 @@ export class CoreAudioBackend extends EventEmitter {
* @returns {Object|null} Device de sortie par défaut
*/
static getDefaultOutputDevice() {
try {
const devices = this.getDevices();
// Chercher d'abord le device marqué comme default
const defaultDevice = devices.find(d => d.isDefault?.output && d.maxOutputChannels > 0);
if (defaultDevice) return defaultDevice;
// Fallback: premier device avec output
return devices.find(d => d.maxOutputChannels > 0) || null;
} catch (error) {
console.error('Erreur getDefaultOutputDevice:', error);
return null;
}
}
/**
+13 -10
View File
@@ -4,7 +4,7 @@ audio:
defaultBitrate: 96
jitterBufferMs: 40
device:
inputDeviceId: 0
inputDeviceId: 1
outputDeviceId: 2
sampleRate: 48000
routing:
@@ -21,22 +21,25 @@ audio:
gains: {}
channelNames:
inputs:
"0": "Micro Régisseur"
"1": "Talkback FOH"
"2": "Retour Console"
"3": "Liaison Scène"
"4": "Monitor Mix"
"5": "Spare 1"
"0": Micro Régisseur
"1": Talkback FOH
"2": Retour Console
"3": Liaison Scène
"4": Monitor Mix
"5": Spare 1
outputs:
"0": "Sortie Principale"
"1": "Retour Scène"
"2": "Talkback Console"
"0": Sortie Principale
"1": Retour Scène
"2": Talkback Console
groups:
- name: Production
audioBitrate: 96
channels: []
- name: Technique
channels: []
- name: Sonorisation
audioBitrate: 128
channels: []
server:
host: 0.0.0.0
port: 3000