2026-02-27 18:35:40 +08:00
|
|
|
import {getServers} from "./icesettings.js";
|
|
|
|
|
|
|
|
|
|
export async function getServerConfig() {
|
|
|
|
|
const protocolEndPoint = location.origin + '/config';
|
|
|
|
|
const createResponse = await fetch(protocolEndPoint);
|
|
|
|
|
return await createResponse.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getRTCConfiguration() {
|
|
|
|
|
let config = {};
|
|
|
|
|
config.sdpSemantics = 'unified-plan';
|
|
|
|
|
config.iceServers = getServers();
|
2026-03-09 20:44:37 +08:00
|
|
|
|
|
|
|
|
// 添加音频处理选项,增强回声消除
|
|
|
|
|
config.mediaConstraints = {
|
|
|
|
|
audio: {
|
|
|
|
|
echoCancellation: true,
|
|
|
|
|
noiseSuppression: true,
|
|
|
|
|
autoGainControl: true,
|
|
|
|
|
highpassFilter: true,
|
|
|
|
|
typingNoiseDetection: true
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 添加WebRTC音频处理选项
|
|
|
|
|
config.rtcConfiguration = {
|
|
|
|
|
'googEchoCancellation': true,
|
|
|
|
|
'googEchoCancellation2': true,
|
|
|
|
|
'googNoiseSuppression': true,
|
|
|
|
|
'googNoiseSuppression2': true,
|
|
|
|
|
'googAutoGainControl': true,
|
|
|
|
|
'googAutoGainControl2': true,
|
|
|
|
|
'googHighpassFilter': true,
|
|
|
|
|
'googTypingNoiseDetection': true
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-27 18:35:40 +08:00
|
|
|
return config;
|
|
|
|
|
}
|