[+] 新增client
This commit is contained in:
13
.gitmodules
vendored
13
.gitmodules
vendored
@@ -1,5 +1,16 @@
|
||||
[submodule "taoyao-media-server/mediasoup"]
|
||||
path = taoyao-media-server/mediasoup
|
||||
url = https://gitee.com/acgist/mediasoup.git
|
||||
# url = https://github.com/acgist/mediasoup.git
|
||||
branch = taoyao
|
||||
[submodule "taoyao-client/mediasoup-client"]
|
||||
path = taoyao-client/mediasoup-client
|
||||
url = https://gitee.com/acgist/mediasoup-client.git
|
||||
branch = taoyao
|
||||
[submodule "taoyao-android/libmediasoupclient"]
|
||||
path = taoyao-android/libmediasoupclient
|
||||
url = https://gitee.com/acgist/libmediasoupclient.git
|
||||
branch = taoyao
|
||||
[submodule "taoyao-desktop/libmediasoupclient"]
|
||||
path = taoyao-desktop/libmediasoupclient
|
||||
url = https://gitee.com/acgist/libmediasoupclient.git
|
||||
branch = taoyao
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
|模块|名称|描述|
|
||||
|:--|:--|:--|
|
||||
|taoyao-client|终端示例|Web端终端示例|
|
||||
|taoyao-client|终端示例|Web终端示例|
|
||||
|taoyao-android|终端示例|安卓终端示例|
|
||||
|taoyao-desktop|终端示例|桌面终端示例|
|
||||
|taoyao-media-server|媒体服务|Mediasoup媒体服务|
|
||||
|taoyao-signal-server|信令服务|信令业务逻辑|
|
||||
|
||||
|
||||
1
taoyao-android/libmediasoupclient
Submodule
1
taoyao-android/libmediasoupclient
Submodule
Submodule taoyao-android/libmediasoupclient added at 55d724ff8b
1
taoyao-client/mediasoup-client
Submodule
1
taoyao-client/mediasoup-client
Submodule
Submodule taoyao-client/mediasoup-client added at 98d314ef32
1
taoyao-desktop/libmediasoupclient
Submodule
1
taoyao-desktop/libmediasoupclient
Submodule
Submodule taoyao-desktop/libmediasoupclient added at 55d724ff8b
@@ -6,8 +6,7 @@
|
||||
|:--|:--|:--|
|
||||
|taoyao|桃夭|桃之夭夭灼灼其华|
|
||||
|taoyao-boot|基础|基础模块|
|
||||
|taoyao-node|集群|集群模块|
|
||||
|taoyao-media|媒体|媒体模块|
|
||||
|taoyao-node|集群|集群模块(可选)|
|
||||
|taoyao-signal|信令|信令服务|
|
||||
|taoyao-server|服务|启动服务|
|
||||
|
||||
@@ -33,12 +32,10 @@
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| taoyao-server |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| taoyao-media | Mediasoup |
|
||||
| taoyao-node | Mediasoup |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| taoyao-signal |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| taoyao-node |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| taoyao-boot |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
```
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<modules>
|
||||
<module>taoyao-boot</module>
|
||||
<module>taoyao-node</module>
|
||||
<module>taoyao-media</module>
|
||||
<module>taoyao-signal</module>
|
||||
<module>taoyao-server</module>
|
||||
</modules>
|
||||
@@ -110,11 +109,6 @@
|
||||
<artifactId>taoyao-node</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao-media</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao-signal</artifactId>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# 媒体
|
||||
|
||||
## 媒体信令
|
||||
|
||||
### 信令格式
|
||||
|
||||
```
|
||||
{
|
||||
"header": {
|
||||
"v": "版本",
|
||||
"id": 请求标识,
|
||||
"sn": "设备标识"
|
||||
"pid": 信令标识,
|
||||
},
|
||||
"code": "响应编码",
|
||||
"message": "响应描述",
|
||||
"body": {
|
||||
// 信令主体
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 终端
|
||||
|
||||
#### 授权信息(6000)
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
### 路由
|
||||
|
||||
### 传输
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>taoyao-media</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>taoyao-media</name>
|
||||
<description>媒体:录制、音频(降噪、混音、变声)、视频(水印、美颜、AI识别)</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao-signal</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -17,6 +17,10 @@
|
||||
<description>集群服务:集群服务</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao-signal</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.acgist.taoyao.node.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.acgist.taoyao.node.listener.platform.ShutdownListener;
|
||||
|
||||
/**
|
||||
* 集群自动配置
|
||||
*
|
||||
@@ -12,34 +16,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnProperty(prefix = "taoyao.node", name = "enabled", havingValue = "true", matchIfMissing = false)
|
||||
public class NodeAutoConfiguration {
|
||||
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public MediaPublishListener mediaPublishListener() {
|
||||
// return new MediaPublishListener();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public MediaSubscribeListener mediaSubscribeListener() {
|
||||
// return new MediaSubscribeListener();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public MediaOfferListener mediaOfferListener() {
|
||||
// return new MediaOfferListener();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public MediaAnswerListener mediaAnswerListener() {
|
||||
// return new MediaAnswerListener();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public MediaCandidateListener mediaCandidateListener() {
|
||||
// return new MediaCandidateListener();
|
||||
// }
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ShutdownListener shutdownListener() {
|
||||
return new ShutdownListener();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.acgist.taoyao.node.listener.platform;
|
||||
|
||||
import com.acgist.taoyao.signal.event.platform.ShutdownEvent;
|
||||
import com.acgist.taoyao.signal.listener.ApplicationListenerAdapter;
|
||||
|
||||
/**
|
||||
* 关闭服务监听
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
public class ShutdownListener extends ApplicationListenerAdapter<ShutdownEvent> {
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ShutdownEvent event) {
|
||||
// TODO:关闭
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.acgist</groupId>
|
||||
<artifactId>taoyao-media</artifactId>
|
||||
<artifactId>taoyao-signal</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -379,6 +379,18 @@ Moon模式有效
|
||||
|
||||
配置订阅媒体:码率、帧率、分辨率等等
|
||||
|
||||
### 终端
|
||||
|
||||
#### 授权信息(6000)
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
### 路由
|
||||
|
||||
### 传输
|
||||
|
||||
|
||||
## 测试
|
||||
|
||||
```
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.acgist.taoyao.signal.event.platform;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.acgist.taoyao.boot.model.Message;
|
||||
import com.acgist.taoyao.signal.client.ClientSession;
|
||||
import com.acgist.taoyao.signal.event.ApplicationEventAdapter;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 关闭服务事件
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ShutdownEvent extends ApplicationEventAdapter {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ShutdownEvent(String sn, Map<?, ?> body, Message message, ClientSession session) {
|
||||
super(sn, body, message, session);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,11 @@ public abstract class ProtocolAdapter implements Protocol {
|
||||
* 信令标识
|
||||
*/
|
||||
protected final Integer pid;
|
||||
/**
|
||||
* 信令标识
|
||||
* TODO:
|
||||
*/
|
||||
protected final String signal = "";
|
||||
/**
|
||||
* 信令名称
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.acgist.taoyao.signal.protocol;
|
||||
|
||||
import java.net.http.WebSocket;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -58,7 +57,7 @@ public class ProtocolManager {
|
||||
if(this.protocolMapping.containsKey(pid)) {
|
||||
throw MessageCodeException.of("存在重复信令协议:" + pid);
|
||||
}
|
||||
log.info("注册信令协议:{}-{}-{}", pid, name, k);
|
||||
log.info("注册信令协议:{}-{}-{}", pid, String.format("%32s", k), name);
|
||||
this.protocolMapping.put(pid, v);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.acgist.taoyao.signal.protocol.platform;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import com.acgist.taoyao.boot.model.Message;
|
||||
import com.acgist.taoyao.signal.client.ClientSession;
|
||||
import com.acgist.taoyao.signal.protocol.ProtocolAdapter;
|
||||
import com.acgist.taoyao.signal.event.platform.ShutdownEvent;
|
||||
import com.acgist.taoyao.signal.protocol.ProtocolMapAdapter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -14,7 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @author acgist
|
||||
*/
|
||||
@Slf4j
|
||||
public class ShutdownProtocol extends ProtocolAdapter {
|
||||
public class ShutdownProtocol extends ProtocolMapAdapter {
|
||||
|
||||
public static final Integer PID = 1000;
|
||||
|
||||
@@ -23,7 +26,9 @@ public class ShutdownProtocol extends ProtocolAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String sn, Message message, ClientSession session) {
|
||||
public void execute(String sn, Map<?, ?> body, Message message, ClientSession session) {
|
||||
// 推送事件
|
||||
this.publishEvent(new ShutdownEvent(sn, body, message, session));
|
||||
// 全员广播
|
||||
this.clientSessionManager.broadcast(message);
|
||||
// 关闭信令服务
|
||||
|
||||
Reference in New Issue
Block a user