Files
taoyao/taoyao-client-web/src/components/Config.js
2023-05-14 09:56:32 +08:00

84 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 音频默认配置
* TODOMediaStreamTrack.applyConstraints()
* TODO播放音量audio标签配置、采集音量
* 支持属性navigator.mediaDevices.getSupportedConstraints()
* https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings
*/
const defaultAudioConfig = {
// 设备
// deviceId : '',
// 音量废弃0.0~1.0
// volume: 1.0,
// 延迟时间单位500毫秒以内较好
// latency: 0.4,
// 采样位数8|16|32
sampleSize: { min: 8, ideal: 16, max: 32 },
// 采样率8000|16000|32000|48000
sampleRate: { min: 8000, ideal: 32000, max: 48000 },
// 声道数量1|2
channelCount: 1,
// 是否开启自动增益true|false
autoGainControl: true,
// 是否开启降噪功能true|false
noiseSuppression: true,
// 是否开启回音消除true|false
echoCancellation: true,
// 消除回音方式system|browser
echoCancellationType: "system",
};
/**
* 视频默认配置
*/
const defaultVideoConfig = {
// 设备
// deviceId: '',
// 宽度
width: { min: 720, ideal: 1280, max: 4096 },
// 高度
height: { min: 480, ideal: 720, max: 2160 },
// 帧率
frameRate: { min: 15, ideal: 24, max: 45 },
// 选摄像头user|left|right|environment
facingMode: "environment",
};
/**
* VP9默认配置
*/
const defaultKsvcEncodings = [{ scalabilityMode: "S3T3_KEY" }];
/**
* simulcast默认配置
*/
const defaultSimulcastEncodings = [
{ scaleResolutionDownBy: 4, maxBitrate: 500000, scalabilityMode: "S1T2" },
{ scaleResolutionDownBy: 2, maxBitrate: 1000000, scalabilityMode: "S1T2" },
{ scaleResolutionDownBy: 1, maxBitrate: 5000000, scalabilityMode: "S1T2" },
];
/**
* RTCPeerConnection默认配置
*/
const defaultRTCPeerConnectionConfig = {
// ICE代理的服务器
iceServers: [],
// 传输通道绑定策略balanced|max-compat|max-bundle
bundlePolicy: "balanced",
// RTCP多路复用策略require|negotiate
rtcpMuxPolicy: "require",
// ICE传输策略all|relay
iceTransportPolicy: "all",
// ICE候选个数
iceCandidatePoolSize: 8,
};
export {
defaultAudioConfig,
defaultVideoConfig,
defaultKsvcEncodings,
defaultSimulcastEncodings,
defaultRTCPeerConnectionConfig,
};