[+] KMS配置

This commit is contained in:
acgist
2022-12-02 08:45:44 +08:00
parent 90870f997f
commit 4a0e1ebbc7
7 changed files with 146 additions and 48 deletions

View File

@@ -49,17 +49,17 @@
流媒体点对点连接,不经过服务端。 流媒体点对点连接,不经过服务端。
#### Mesh注意事项 #### 注意事项
* ~~直播~~ * ~~直播~~
* 会议:一对一、~~多对多~~ * 会议:一对一、~~多对多~~
* ~~媒体:录制、降噪、美颜等等~~ * ~~媒体:录制、降噪、美颜等等~~
* 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能 * 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能
### MCU ### MCU/SFU
终端推流到服务端,由服务端处理分流。 终端推流到服务端,由服务端处理分流。
### SFU #### 注意事项
终端推流到服务端,由服务端直接分流。 * 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server)

View File

@@ -137,7 +137,7 @@ systemctl start taoyao
systemctl enable taoyao systemctl enable taoyao
``` ```
# KMSKurento Media Server ## KMSKurento Media Server
``` ```
``` ```

View File

@@ -0,0 +1,60 @@
package com.acgist.taoyao.boot.config;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* KMS配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "KMS配置", description = "KMS配置")
public class KmsProperties {
/**
* KMS主机
*/
@Schema(title = "KMS主机", description = "KMS主机")
private String host;
/**
* KMS端口
*/
@Schema(title = "KMS端口", description = "KMS端口")
private Integer port;
/**
* KMS协议
*/
@Schema(title = "KMS协议", description = "KMS协议")
private String schema;
/**
* KMS地址
*/
@Schema(title = "KMS地址", description = "KMS地址")
private String websocket;
/**
* KMS用户
*/
@Schema(title = "KMS用户", description = "KMS用户")
@JsonIgnore
private String username;
/**
* KMS密码
*/
@Schema(title = "KMS密码", description = "KMS密码")
@JsonIgnore
private String password;
/**
* @return 完整KMS地址
*/
@Schema(title = "完整KMS地址", description = "完整KMS地址")
public String getAddress() {
return this.schema + "://" + this.host + ":" + this.port + this.websocket;
}
}

View File

@@ -0,0 +1,46 @@
package com.acgist.taoyao.boot.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* 信令配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "信令配置", description = "信令配置")
public class SignalProperties {
/**
* 信令主机
*/
@Schema(title = "信令主机", description = "信令主机")
private String host;
/**
* 信令端口
*/
@Schema(title = "信令端口", description = "信令端口")
private Integer port;
/**
* 信令协议
*/
@Schema(title = "信令协议", description = "信令协议")
private String schema;
/**
* 信令地址
*/
@Schema(title = "信令地址", description = "信令地址")
private String websocket;
/**
* @return 完整信令地址
*/
@Schema(title = "完整信令地址", description = "完整信令地址")
public String getAddress() {
return this.schema + "://" + this.host + ":" + this.port + this.websocket;
}
}

View File

@@ -44,6 +44,16 @@ public class WebrtcProperties {
*/ */
@Schema(title = "架构模型", description = "WebRTC架构模型") @Schema(title = "架构模型", description = "WebRTC架构模型")
private Framework framework; private Framework framework;
/**
* 媒体最小端口
*/
@Schema(title = "媒体最小端口", description = "媒体最小端口")
private Integer minPort;
/**
* 媒体最大端口
*/
@Schema(title = "媒体最大端口", description = "媒体最大端口")
private Integer maxPort;
/** /**
* stun服务器 * stun服务器
*/ */
@@ -55,42 +65,14 @@ public class WebrtcProperties {
@Schema(title = "turn服务器", description = "turn服务器") @Schema(title = "turn服务器", description = "turn服务器")
private String[] turn; private String[] turn;
/** /**
* 信令主机 * KMS配置
*/ */
@Schema(title = "信令主机", description = "信令主机") @Schema(title = "KMS配置", description = "KMS配置")
private String host; private KmsProperties kms;
/** /**
* 信令端口 * 信令配置
*/ */
@Schema(title = "信令端口", description = "信令端口") @Schema(title = "信令配置", description = "信令配置")
private Integer port; private SignalProperties signal;
/**
* 信令协议
*/
@Schema(title = "信令协议", description = "信令协议")
private String schema;
/**
* 信令地址
*/
@Schema(title = "信令地址", description = "信令地址")
private String websocket;
/**
* 媒体最小端口
*/
@Schema(title = "媒体最小端口", description = "媒体最小端口")
private Integer minPort;
/**
* 媒体最大端口
*/
@Schema(title = "媒体最大端口", description = "媒体最大端口")
private Integer maxPort;
/**
* 完整信令地址
*/
@Schema(title = "完整信令地址", description = "完整信令地址")
public String getSignalAddress() {
return this.schema + "://" + this.host + ":" + this.port + this.websocket;
}
} }

View File

@@ -69,7 +69,11 @@ taoyao:
quality: high|standard|quick quality: high|standard|quick
# WebRTC配置 # WebRTC配置
webrtc: webrtc:
# 架构模式
framework: MESH framework: MESH
# 媒体端口范围
min-port: 45535
max-port: 65535
stun: stun:
- stun:stun1.l.google.com:19302 - stun:stun1.l.google.com:19302
- stun:stun2.l.google.com:19302 - stun:stun2.l.google.com:19302
@@ -82,14 +86,20 @@ taoyao:
- stun:stun3.l.google.com:19302 - stun:stun3.l.google.com:19302
- stun:stun4.l.google.com:19302 - stun:stun4.l.google.com:19302
- stun:stun.stunprotocol.org:3478 - stun:stun.stunprotocol.org:3478
# KMS服务配置
kms:
host: 192.168.1.100
port: 18888
schema: wss
websocket: /websocket.signal
username: username
password: password
# 信令服务配置 # 信令服务配置
host: 192.168.1.100 signal:
port: ${server.port:8888} host: 192.168.1.100
schema: wss port: ${server.port:8888}
websocket: /websocket.signal schema: wss
# 媒体端口范围 websocket: /websocket.signal
min-port: 45535
max-port: 65535
record: record:
storage: /data/record storage: /data/record
security: security:

View File

@@ -550,7 +550,7 @@ function Taoyao(
/** WebRTC配置 */ /** WebRTC配置 */
this.configWebrtc = function(config = {}) { this.configWebrtc = function(config = {}) {
this.webrtc = config; this.webrtc = config;
this.webSocket = this.webrtc.signalAddress; this.webSocket = this.webrtc.signal.address;
defaultRPCConfig.iceServers = this.webrtc.stun.map(v => ({'urls': v})); defaultRPCConfig.iceServers = this.webrtc.stun.map(v => ({'urls': v}));
console.debug('WebRTC配置', this.webrtc, defaultRPCConfig); console.debug('WebRTC配置', this.webrtc, defaultRPCConfig);
return this; return this;