Twilioapp/src/config/twilio.ts
2025-06-28 17:07:18 +08:00

51 lines
1.2 KiB
TypeScript
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.

export interface TwilioConfig {
apiKey: string;
apiSecret: string;
accountSid: string;
videoServiceSid?: string;
conversationServiceSid?: string;
}
// Twilio配置
export const twilioConfig: TwilioConfig = {
apiKey: 'SK3b25e00e6914162a7cf829cffc415cb3',
apiSecret: 'PpGH298dlRgMSeGrexUjw1flczTVIw9H',
accountSid: 'AC_YOUR_ACCOUNT_SID', // 需要从Twilio控制台获取
videoServiceSid: '', // 可选视频服务SID
conversationServiceSid: '', // 可选对话服务SID
};
// Token服务器URL开发环境
export const TOKEN_SERVER_URL = process.env.NODE_ENV === 'production'
? 'https://your-production-server.com/api/twilio/token'
: 'http://localhost:3001/api/twilio/token';
// 视频配置选项
export const videoOptions = {
audio: true,
video: {
width: 640,
height: 480,
frameRate: 24,
},
bandwidthProfile: {
video: {
mode: 'collaboration' as const,
maxTracks: 10,
},
},
dominantSpeaker: true,
networkQuality: {
local: 1,
remote: 1,
},
};
// 房间类型
export enum RoomType {
GROUP = 'group',
GROUP_SMALL = 'group-small',
PEER_TO_PEER = 'peer-to-peer',
}
export default twilioConfig;