Estoy haciendo una grabación de pantalla usando RecordRTC.
¿Cómo incluyo el audio de mi micrófono al grabar?
Mi código a continuación usando Angular:
async startRecording() { let mediaConstraints = { video: { }, audio: true }; await this.mediaDevices.getDisplayMedia(mediaConstraints).then(this.successCallback.bind(this), this.errorCallback.bind(this)); } successCallback(stream: MediaStream) { this.recording = true; var options = { mimeType: 'video/webm', // or video/webm\;codecs=h264 or video/webm\;codecs=vp9 audioBitsPerSecond: 128000, videoBitsPerSecond: 128000, bitsPerSecond: 128000 // if this line is provided, skip above two }; this.stream = stream; this.recordRTC = RecordRTC(stream, options); this.recordRTC.startRecording(); let video: HTMLVideoElement = this.rtcvideo.nativeElement; video.src = window.URL.createObjectURL(stream); this.toggleControls(); }Debes adjuntar una pista de audio a la transmisión.
successCallback(stream){ //your other code here //... navigator.mediaDevices.getUserMedia({audio:true}).then(function(mic) { stream.addTrack(mic.getTracks()[0]); }); // this.recordRTC = RecordRTC(stream, options); this.recordRTC.startRecording(); }Esto debería ser útil. https://www.webrtc-experiment.com/RecordRTC/