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:
@@ -81,7 +81,7 @@ define(['./workbox-290dd570'], (function (workbox) { 'use strict';
|
|||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.u6ufl8c15b8"
|
"revision": "0.u556t341pt8"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
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
|
* @returns {Object|null} Device d'entrée par défaut
|
||||||
*/
|
*/
|
||||||
static getDefaultInputDevice() {
|
static getDefaultInputDevice() {
|
||||||
const devices = this.getDevices();
|
try {
|
||||||
return devices.find(d => d.maxInputChannels > 0) || null;
|
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
|
* @returns {Object|null} Device de sortie par défaut
|
||||||
*/
|
*/
|
||||||
static getDefaultOutputDevice() {
|
static getDefaultOutputDevice() {
|
||||||
const devices = this.getDevices();
|
try {
|
||||||
return devices.find(d => d.maxOutputChannels > 0) || null;
|
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
@@ -4,7 +4,7 @@ audio:
|
|||||||
defaultBitrate: 96
|
defaultBitrate: 96
|
||||||
jitterBufferMs: 40
|
jitterBufferMs: 40
|
||||||
device:
|
device:
|
||||||
inputDeviceId: 0
|
inputDeviceId: 1
|
||||||
outputDeviceId: 2
|
outputDeviceId: 2
|
||||||
sampleRate: 48000
|
sampleRate: 48000
|
||||||
routing:
|
routing:
|
||||||
@@ -21,22 +21,25 @@ audio:
|
|||||||
gains: {}
|
gains: {}
|
||||||
channelNames:
|
channelNames:
|
||||||
inputs:
|
inputs:
|
||||||
"0": "Micro Régisseur"
|
"0": Micro Régisseur
|
||||||
"1": "Talkback FOH"
|
"1": Talkback FOH
|
||||||
"2": "Retour Console"
|
"2": Retour Console
|
||||||
"3": "Liaison Scène"
|
"3": Liaison Scène
|
||||||
"4": "Monitor Mix"
|
"4": Monitor Mix
|
||||||
"5": "Spare 1"
|
"5": Spare 1
|
||||||
outputs:
|
outputs:
|
||||||
"0": "Sortie Principale"
|
"0": Sortie Principale
|
||||||
"1": "Retour Scène"
|
"1": Retour Scène
|
||||||
"2": "Talkback Console"
|
"2": Talkback Console
|
||||||
groups:
|
groups:
|
||||||
- name: Production
|
- name: Production
|
||||||
audioBitrate: 96
|
audioBitrate: 96
|
||||||
|
channels: []
|
||||||
- name: Technique
|
- name: Technique
|
||||||
|
channels: []
|
||||||
- name: Sonorisation
|
- name: Sonorisation
|
||||||
audioBitrate: 128
|
audioBitrate: 128
|
||||||
|
channels: []
|
||||||
server:
|
server:
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 3000
|
port: 3000
|
||||||
|
|||||||
Reference in New Issue
Block a user