mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Add recording support
This commit is contained in:
		
							
								
								
									
										16
									
								
								assets/3rdparty/MediaStreamRecorder.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								assets/3rdparty/MediaStreamRecorder.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -150,7 +150,7 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.call-window .window-bottom .dropdown-menu {
 | 
			
		||||
	left: -95px;
 | 
			
		||||
	left: -125px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.call-window .window-bottom .dropdown-menu i {
 | 
			
		||||
 
 | 
			
		||||
@@ -203,6 +203,15 @@ class CallWindow extends CustomEvents {
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
 | 
			
		||||
				// Record streams
 | 
			
		||||
				{
 | 
			
		||||
					icon: "fa-save",
 | 
			
		||||
					text: "Start / Stop recording",
 | 
			
		||||
					onclick: () => {
 | 
			
		||||
						this.startRecording()
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
 | 
			
		||||
			]
 | 
			
		||||
 | 
			
		||||
			//Add buttons
 | 
			
		||||
@@ -885,4 +894,41 @@ class CallWindow extends CustomEvents {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Start / stop recording the streams
 | 
			
		||||
	 */
 | 
			
		||||
	startRecording() {
 | 
			
		||||
 | 
			
		||||
		const onDataAvailable = blob => {
 | 
			
		||||
			console.info("New record  available", blob)
 | 
			
		||||
 | 
			
		||||
			// = GET URL = const url = URL.createObjectURL(blob)
 | 
			
		||||
 | 
			
		||||
			// Save file
 | 
			
		||||
			saveAs(blob, new Date().getTime() + ".webm")
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Start recording
 | 
			
		||||
		if(!this.recorder) {
 | 
			
		||||
			// Determine the list of streams to save
 | 
			
		||||
			const streams = []
 | 
			
		||||
 | 
			
		||||
			if(this.mainStream)
 | 
			
		||||
				streams.push(this.mainStream)
 | 
			
		||||
			this.streamsEls.forEach(v => streams.push(v))
 | 
			
		||||
 | 
			
		||||
			// Create & start recorder
 | 
			
		||||
			this.recorder = new MultiStreamRecorder(streams);
 | 
			
		||||
			this.recorder.ondataavailable = onDataAvailable
 | 
			
		||||
			this.recorder.start(30*60*1000); // Ask for save every 30min
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		// Stop recording
 | 
			
		||||
		else {
 | 
			
		||||
			this.recorder.stop(onDataAvailable)
 | 
			
		||||
			delete this.recorder
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -165,6 +165,9 @@ class Dev {
 | 
			
		||||
 | 
			
		||||
		// Share screen
 | 
			
		||||
		"3rdparty/getScreenId.js",
 | 
			
		||||
 | 
			
		||||
		// Record MediaStream
 | 
			
		||||
		"3rdparty/MediaStreamRecorder.min.js"
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user