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