This commit is contained in:
acgist
2023-03-14 07:53:32 +08:00
parent 72e4b34630
commit 0cd054dbb0
25 changed files with 242 additions and 203 deletions

View File

@@ -1,13 +1,7 @@
# Web终端
注意部分`API`需要`localhost`或者`https`
## Web终端
* [mediasoup-client源码](https://github.com/versatica/mediasoup-client)
* [mediasoup-client文档](https://mediasoup.org/documentation/v3/mediasoup-client)
* [mediasoup-client接口](https://mediasoup.org/documentation/v3/mediasoup-client/api)
## TODO
按钮:选择房间、媒体服务、开关

View File

@@ -21,8 +21,9 @@ const protocol = {
* @returns 索引
*/
buildId() {
if (++this.index > this.maxIndex) {
this.index = 0;
const me = this;
if (++me.index > me.maxIndex) {
me.index = 0;
}
const date = new Date();
return (
@@ -30,8 +31,8 @@ const protocol = {
1000000000000 * date.getHours() +
10000000000 * date.getMinutes() +
100000000 * date.getSeconds() +
1000 * this.clientIndex +
this.index
1000 * me.clientIndex +
me.index
);
},
/**
@@ -2010,23 +2011,25 @@ class Taoyao extends RemoteClient {
*/
closeMedia() {
let me = this;
if (me.sendTransport) {
me.sendTransport.close();
}
if (me.recvTransport) {
me.recvTransport.close();
}
if(me.audioTrack) {
me.audioTrack.stop();
}
if(me.videoTrack) {
me.videoTrack.stop();
}
if (me.sendTransport) {
me.sendTransport.close();
}
if (me.recvTransport) {
me.recvTransport.close();
}
me.sendTransport = null;
me.recvTransport = null;
me.dataProducer = null;
me.audioProducer = null;
me.videoProducer = null;
me.dataProducer = null;
me.consumers.clear();
me.dataConsumers.clear();
}
/**
* 关闭资源