This commit is contained in:
acgist
2022-12-03 17:37:06 +08:00
parent 7f5ee58fbb
commit 2908faf9df
3 changed files with 13 additions and 6 deletions

View File

@@ -65,7 +65,7 @@ public class MeetingManager {
*/
public Meeting create(String sn) {
final Meeting meeting = new Meeting();
meeting.setId("1");
meeting.setId(this.idService.buildIdToString());
meeting.setSns(new CopyOnWriteArrayList<>());
meeting.setCreator(sn);
meeting.addSn(sn);

View File

@@ -491,6 +491,7 @@ function TaoyaoClient(
return this;
};
/** 设置媒体 */
// TODOstream判断
this.buildStream = async function(videoId, stream, track) {
if(!this.video && videoId) {
this.video = document.getElementById(videoId);
@@ -534,6 +535,7 @@ function TaoyaoClient(
this.buildAudioTrack = function(track) {
// 关闭旧的
// 创建新的
track.sn = this.sn;
this.audioStatus = true;
this.audioTrack.push(track);
if(this.audioEnabled) {
@@ -544,6 +546,7 @@ function TaoyaoClient(
this.buildVideoTrack = function(track) {
// 关闭旧的
// 创建新的
track.sn = this.sn;
this.videoStatus = true;
this.videoTrack.push(track);
if(this.videoEnabled) {
@@ -564,6 +567,7 @@ function TaoyaoClient(
mediaChannel.ontrack = function(e) {
console.debug('Mesh Media Track', self.sn, e);
let remote = self.taoyao.remoteClientFilter(self.sn);
// TODO判断数量
remote.buildStream(remote.sn, e.streams[0], e.track);
};
mediaChannel.onicecandidate = function(e) {
@@ -761,9 +765,9 @@ function Taoyao(
// 远程通道
this.remoteMediaChannel = new RTCPeerConnection(defaultRPCConfig);
this.remoteMediaChannel.ontrack = function(e) {
console.debug('Remote Media Track', e);
// TODO匹配
let remote = self.remoteClient[0];
console.debug('Remote Media Track', e.track.sn, e);
let remote = self.taoyao.remoteClientFilter(e.track.sn);
// TODO判断数量
remote.buildStream(remote.sn, e.streams[0], e.track);
};
this.remoteMediaChannel.onicecandidate = function(e) {

View File

@@ -50,6 +50,10 @@
meetingId: null
},
mounted() {
// 设置帐号
let sn = prompt('你的账号', signalConfig.sn);
signalConfig.sn = sn;
// 加载桃夭
let self = this;
this.taoyao = new Taoyao('local');
this.remoteClient = this.taoyao.remoteClient;
@@ -70,8 +74,6 @@
},
// 创建会议
create: function(event) {
let sn = prompt('你的账号', signalConfig.sn);
signalConfig.sn = sn;
let self = this;
this.taoyao.meetingCreate(data => {
self.taoyao.meetingEnter(data.body.id);
@@ -84,6 +86,7 @@
// 进入会议
enter: function(sn) {
let id = prompt('房间标识');
let password = prompt('房间密码');
if(id) {
this.taoyao.meetingEnter(id);
}