WebRTC Module

This commit is contained in:
Abdussamed 2023-04-21 18:30:27 +03:00
parent 239a5c22fe
commit 23d6d3a55d
1 changed files with 9 additions and 6 deletions

View File

@ -119,12 +119,15 @@ export default class WebRTC
}
case "streamAccept":{
let {id} = data;
let {stream} = this.sendingStream.get(id) as {stream:MediaStream};
let sendingStream = this.sendingStream.get(id) as TransferStreamInfo;
let senders = [];
for (const track of stream.getTracks()) {
senders.push(this.rtc.addTrack(track, stream));
};
stream.senders = senders;
if(sendingStream && sendingStream.stream)
{
for (const track of sendingStream.stream.getTracks()) {
senders.push(this.rtc.addTrack(track, sendingStream.stream));
};
sendingStream.senders = senders;
}
break;
}
case "message":{
@ -285,7 +288,7 @@ export default class WebRTC
{
for (const stream of event.streams) {
let streamInfo = this.recaivingStream.get(stream.id) as TransferStreamInfo;
streamInfo.recaivers.push(rtpRecaiver);
(streamInfo.recaivers || (streamInfo.recaivers = [])).push(rtpRecaiver);
if((this.recaivingStream.get(stream.id) as {stream : MediaStream | undefined}).stream == null)
{
streamInfo.stream = stream;