[*] 日常优化
This commit is contained in:
@@ -214,7 +214,7 @@ export default {
|
||||
switch (signal) {
|
||||
case "media::track" :
|
||||
const { clientId, track } = body;
|
||||
console.info("新增媒体轨道", clientId, track);
|
||||
console.debug("新增媒体轨道", clientId, track);
|
||||
break;
|
||||
case "client::config" :
|
||||
this.roomVisible = true;
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
* 配置
|
||||
*/
|
||||
const config = {
|
||||
// 媒体配置
|
||||
media: {
|
||||
// 是否预览共享文件
|
||||
filePreview: true
|
||||
},
|
||||
// 信令配置
|
||||
signal: {
|
||||
// 信令版本
|
||||
version : "1.0.0",
|
||||
// 终端类型
|
||||
clientType: "WEB",
|
||||
}
|
||||
},
|
||||
}
|
||||
/**
|
||||
* 音频默认配置
|
||||
|
||||
@@ -957,8 +957,11 @@ class Taoyao extends RemoteClient {
|
||||
this.fileVideo.muted = true;
|
||||
this.fileVideo.controls = true;
|
||||
this.fileVideo.src = URL.createObjectURL(input.files[0]);
|
||||
this.fileVideo.style = "position:fixed;top:1rem;left:1rem;width:128px;border:2px solid #FFF;";
|
||||
// this.fileVideo.style.display = "none";
|
||||
if(config.media.filePreview) {
|
||||
this.fileVideo.style = "position:fixed;top:1rem;left:1rem;width:128px;border:2px solid #FFF;";
|
||||
} else {
|
||||
this.fileVideo.style.display = "none";
|
||||
}
|
||||
document.body.appendChild(this.fileVideo);
|
||||
// 开始播放不然不能采集
|
||||
await this.fileVideo.play();
|
||||
@@ -1860,48 +1863,6 @@ class Taoyao extends RemoteClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停生产者信令
|
||||
*
|
||||
* @param {*} producerId 生产者ID
|
||||
*/
|
||||
mediaProducerPause(producerId) {
|
||||
const me = this;
|
||||
const producer = me.getProducer(producerId);
|
||||
if(producer) {
|
||||
if(producer.paused) {
|
||||
return;
|
||||
}
|
||||
console.debug("暂停生产者", producerId);
|
||||
me.push(protocol.buildMessage("media::producer::pause", {
|
||||
roomId : me.roomId,
|
||||
producerId: producerId,
|
||||
}));
|
||||
} else {
|
||||
console.debug("暂停生产者无效", producerId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停生产者信令
|
||||
*
|
||||
* @param {*} message 消息
|
||||
*/
|
||||
async defaultMediaProducerPause(message) {
|
||||
const me = this;
|
||||
const {
|
||||
roomId,
|
||||
producerId
|
||||
} = message.body;
|
||||
const producer = me.getProducer(producerId);
|
||||
if (producer) {
|
||||
console.debug("暂停生产者", producerId);
|
||||
producer.pause();
|
||||
} else {
|
||||
console.debug("暂停生产者无效", producerId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费媒体信令
|
||||
*
|
||||
@@ -2469,6 +2430,50 @@ class Taoyao extends RemoteClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停生产者信令
|
||||
*
|
||||
* @param {*} producerId 生产者ID
|
||||
*/
|
||||
mediaProducerPause(producerId) {
|
||||
const producer = this.getProducer(producerId);
|
||||
if(!producer) {
|
||||
console.debug("暂停生产者(生产者无效)", producerId);
|
||||
return;
|
||||
}
|
||||
if(producer.paused) {
|
||||
console.debug("暂停生产者(生产者已经暂停)", producerId);
|
||||
return;
|
||||
}
|
||||
console.debug("暂停生产者", producerId);
|
||||
this.push(protocol.buildMessage("media::producer::pause", {
|
||||
producerId,
|
||||
roomId: this.roomId,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停生产者信令
|
||||
*
|
||||
* @param {*} message 消息
|
||||
*/
|
||||
async defaultMediaProducerPause(message) {
|
||||
const {
|
||||
producerId
|
||||
} = message.body;
|
||||
const producer = this.getProducer(producerId);
|
||||
if (!producer) {
|
||||
console.debug("暂停生产者(生产者无效)", producerId);
|
||||
return;
|
||||
}
|
||||
if(producer.paused) {
|
||||
console.debug("暂停生产者(生产者已经暂停)", producerId);
|
||||
return;
|
||||
}
|
||||
console.debug("暂停生产者", producerId);
|
||||
producer.pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复生产者信令
|
||||
*
|
||||
@@ -3696,6 +3701,7 @@ class Taoyao extends RemoteClient {
|
||||
await client.close();
|
||||
});
|
||||
me.remoteClients.clear();
|
||||
me.closeFileVideo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3709,6 +3715,7 @@ class Taoyao extends RemoteClient {
|
||||
console.debug("关闭会话", sessionId);
|
||||
});
|
||||
me.sessionClients.clear();
|
||||
me.closeFileVideo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user