mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	RTC: Refine publish security error message (#2762). v4.0.200
This commit is contained in:
		
							parent
							
								
									0c5e528e66
								
							
						
					
					
						commit
						542a3e4f36
					
				
					 3 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -47,6 +47,9 @@ function SrsRtcPublisherAsync() {
 | 
			
		|||
        self.pc.addTransceiver("audio", {direction: "sendonly"});
 | 
			
		||||
        self.pc.addTransceiver("video", {direction: "sendonly"});
 | 
			
		||||
 | 
			
		||||
        if (!navigator.mediaDevices && window.location.protocol === 'http:' && window.location.hostname !== 'localhost') {
 | 
			
		||||
            throw new Error(`Please use HTTPS or localhost to publish, read https://github.com/ossrs/srs/issues/2762#issuecomment-983147576`);
 | 
			
		||||
        }
 | 
			
		||||
        var stream = await navigator.mediaDevices.getUserMedia(self.constraints);
 | 
			
		||||
 | 
			
		||||
        // @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue