WebRTC Module
This commit is contained in:
parent
21c822152b
commit
66df2e7962
|
@ -3,6 +3,7 @@ import Peer from "./Peer";
|
||||||
interface TransferStreamInfo
|
interface TransferStreamInfo
|
||||||
{
|
{
|
||||||
senders : RTCRtpSender[];
|
senders : RTCRtpSender[];
|
||||||
|
recaivers : RTCRtpReceiver[];
|
||||||
stream:MediaStream | undefined;
|
stream:MediaStream | undefined;
|
||||||
id:string;
|
id:string;
|
||||||
name:string;
|
name:string;
|
||||||
|
@ -279,19 +280,18 @@ export default class WebRTC
|
||||||
}
|
}
|
||||||
public eventTrack(event: RTCTrackEvent)
|
public eventTrack(event: RTCTrackEvent)
|
||||||
{
|
{
|
||||||
|
let rtpRecaiver = event.receiver;
|
||||||
if(event.streams.length)
|
if(event.streams.length)
|
||||||
{
|
{
|
||||||
for (const stream of event.streams) {
|
for (const stream of event.streams) {
|
||||||
|
let streamInfo = this.recaivingStream.get(stream.id) as TransferStreamInfo;
|
||||||
|
streamInfo.recaivers.push(rtpRecaiver);
|
||||||
if((this.recaivingStream.get(stream.id) as {stream : MediaStream | undefined}).stream == null)
|
if((this.recaivingStream.get(stream.id) as {stream : MediaStream | undefined}).stream == null)
|
||||||
{
|
{
|
||||||
(
|
streamInfo.stream = stream;
|
||||||
this.recaivingStream.get(stream.id) as {stream : MediaStream | undefined}
|
|
||||||
).stream = stream;
|
|
||||||
this.emit('stream:added', this.recaivingStream.get(stream.id));
|
this.emit('stream:added', this.recaivingStream.get(stream.id));
|
||||||
}else{
|
}else{
|
||||||
(
|
streamInfo.stream = stream;
|
||||||
this.recaivingStream.get(stream.id) as {stream : MediaStream | undefined}
|
|
||||||
).stream = stream;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue