diff --git a/README.md b/README.md index 2f04677..78ab77b 100644 --- a/README.md +++ b/README.md @@ -49,17 +49,17 @@ 流媒体点对点连接,不经过服务端。 -#### Mesh注意事项 +#### 注意事项 * ~~直播~~ * 会议:一对一、~~多对多~~ * ~~媒体:录制、降噪、美颜等等~~ * 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能 -### MCU +### MCU/SFU -终端推流到服务端,由服务端处理分流。 +终端推流到服务端,由服务端处理后分流。 -### SFU +#### 注意事项 -终端推流到服务端,由服务端直接分流。 +* 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server) \ No newline at end of file diff --git a/docs/Deploy.md b/docs/Deploy.md index c1bdf98..4778c02 100644 --- a/docs/Deploy.md +++ b/docs/Deploy.md @@ -137,7 +137,7 @@ systemctl start taoyao systemctl enable taoyao ``` -# KMS(Kurento Media Server) +## KMS(Kurento Media Server) ``` ``` diff --git a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/KmsProperties.java b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/KmsProperties.java new file mode 100644 index 0000000..0fc55c1 --- /dev/null +++ b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/KmsProperties.java @@ -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; + } + +} diff --git a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/SignalProperties.java b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/SignalProperties.java new file mode 100644 index 0000000..ffcebb7 --- /dev/null +++ b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/SignalProperties.java @@ -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; + } + +} diff --git a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java index 7af9c19..46d0126 100644 --- a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java +++ b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java @@ -44,6 +44,16 @@ public class WebrtcProperties { */ @Schema(title = "架构模型", description = "WebRTC架构模型") private Framework framework; + /** + * 媒体最小端口 + */ + @Schema(title = "媒体最小端口", description = "媒体最小端口") + private Integer minPort; + /** + * 媒体最大端口 + */ + @Schema(title = "媒体最大端口", description = "媒体最大端口") + private Integer maxPort; /** * stun服务器 */ @@ -55,42 +65,14 @@ public class WebrtcProperties { @Schema(title = "turn服务器", description = "turn服务器") private String[] turn; /** - * 信令主机 + * KMS配置 */ - @Schema(title = "信令主机", description = "信令主机") - private String host; + @Schema(title = "KMS配置", description = "KMS配置") + private KmsProperties kms; /** - * 信令端口 + * 信令配置 */ - @Schema(title = "信令端口", description = "信令端口") - private Integer port; - /** - * 信令协议 - */ - @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; - } + @Schema(title = "信令配置", description = "信令配置") + private SignalProperties signal; } diff --git a/taoyao-server/src/main/resources/application.yml b/taoyao-server/src/main/resources/application.yml index a3195bd..7b424c0 100644 --- a/taoyao-server/src/main/resources/application.yml +++ b/taoyao-server/src/main/resources/application.yml @@ -69,7 +69,11 @@ taoyao: quality: high|standard|quick # WebRTC配置 webrtc: + # 架构模式 framework: MESH + # 媒体端口范围 + min-port: 45535 + max-port: 65535 stun: - stun:stun1.l.google.com:19302 - stun:stun2.l.google.com:19302 @@ -82,14 +86,20 @@ taoyao: - stun:stun3.l.google.com:19302 - stun:stun4.l.google.com:19302 - 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 - port: ${server.port:8888} - schema: wss - websocket: /websocket.signal - # 媒体端口范围 - min-port: 45535 - max-port: 65535 + signal: + host: 192.168.1.100 + port: ${server.port:8888} + schema: wss + websocket: /websocket.signal record: storage: /data/record security: diff --git a/taoyao-server/src/main/resources/static/javascript/taoyao.js b/taoyao-server/src/main/resources/static/javascript/taoyao.js index 44cef8d..ec066f8 100644 --- a/taoyao-server/src/main/resources/static/javascript/taoyao.js +++ b/taoyao-server/src/main/resources/static/javascript/taoyao.js @@ -550,7 +550,7 @@ function Taoyao( /** WebRTC配置 */ this.configWebrtc = function(config = {}) { this.webrtc = config; - this.webSocket = this.webrtc.signalAddress; + this.webSocket = this.webrtc.signal.address; defaultRPCConfig.iceServers = this.webrtc.stun.map(v => ({'urls': v})); console.debug('WebRTC配置', this.webrtc, defaultRPCConfig); return this;