mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Start to request screen sharing
This commit is contained in:
		@@ -791,4 +791,31 @@ function IsFullScreen(){
 | 
			
		||||
 */
 | 
			
		||||
function checkEmojiCode(s) {
 | 
			
		||||
	return s.match(/^:[a-zA-Z0-9]+:$/) != null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Request user screen as stream
 | 
			
		||||
 * 
 | 
			
		||||
 * @return {Promise<MediaStream>}
 | 
			
		||||
 */
 | 
			
		||||
function requestUserScreen() {
 | 
			
		||||
	return new Promise((onSuccess, onFailure) => {
 | 
			
		||||
		getScreenId(function (error, sourceId, screen_constraints) {
 | 
			
		||||
			
 | 
			
		||||
			if(error != null)
 | 
			
		||||
				return onFailure(error)
 | 
			
		||||
			
 | 
			
		||||
			// error    == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome'
 | 
			
		||||
			// sourceId == null || 'string' || 'firefox'
 | 
			
		||||
			
 | 
			
		||||
			if(navigator.getDisplayMedia) {
 | 
			
		||||
				navigator.getDisplayMedia(screen_constraints).then(onSuccess, onFailure);
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				navigator.mediaDevices.getUserMedia(screen_constraints).then(onSuccess).catch(onFailure);
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		});
 | 
			
		||||
	})
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user