[mirotalksfu] - #33 fix - add more logs
هذا الالتزام موجود في:
@@ -5,7 +5,6 @@ class MixedAudioRecorder {
|
|||||||
this.useGainNode = useGainNode;
|
this.useGainNode = useGainNode;
|
||||||
this.gainNode = null;
|
this.gainNode = null;
|
||||||
this.audioSources = [];
|
this.audioSources = [];
|
||||||
this.audioSource = null;
|
|
||||||
this.audioDestination = null;
|
this.audioDestination = null;
|
||||||
this.audioContext = this.createAudioContext();
|
this.audioContext = this.createAudioContext();
|
||||||
}
|
}
|
||||||
@@ -32,22 +31,23 @@ class MixedAudioRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audioStreams.forEach((stream) => {
|
audioStreams.forEach((stream) => {
|
||||||
if (!stream.getTracks().filter((t) => t.kind === 'audio').length) {
|
if (!stream || !stream.getTracks().filter((t) => t.kind === 'audio').length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Mixed audio tracks to add on MediaStreamAudioDestinationNode --->', stream.getTracks());
|
||||||
|
|
||||||
let audioSource = this.audioContext.createMediaStreamSource(stream);
|
let audioSource = this.audioContext.createMediaStreamSource(stream);
|
||||||
|
|
||||||
if (this.useGainNode) {
|
if (this.useGainNode) {
|
||||||
audioSource.connect(this.gainNode);
|
audioSource.connect(this.gainNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.audioSources.push(audioSource);
|
this.audioSources.push(audioSource);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.audioDestination = this.audioContext.createMediaStreamDestination();
|
this.audioDestination = this.audioContext.createMediaStreamDestination();
|
||||||
this.audioSources.forEach((source) => {
|
this.audioSources.forEach((audioSource) => {
|
||||||
source.connect(this.audioDestination);
|
audioSource.connect(this.audioDestination);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.audioDestination.stream;
|
return this.audioDestination.stream;
|
||||||
@@ -72,6 +72,7 @@ class MixedAudioRecorder {
|
|||||||
this.audioContext.close();
|
this.audioContext.close();
|
||||||
this.audioContext = null;
|
this.audioContext = null;
|
||||||
}
|
}
|
||||||
|
console.log('Stop Mixed Audio Stream');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,8 +186,9 @@ class RoomClient {
|
|||||||
this.rightMsgAvatar = null;
|
this.rightMsgAvatar = null;
|
||||||
|
|
||||||
this.localVideoStream = null;
|
this.localVideoStream = null;
|
||||||
this.localScreenStream = null;
|
|
||||||
this.localAudioStream = null;
|
this.localAudioStream = null;
|
||||||
|
this.localScreenStream = null;
|
||||||
|
this.localScreenAudioTabStream = null;
|
||||||
this.mediaRecorder = null;
|
this.mediaRecorder = null;
|
||||||
this.recScreenStream = null;
|
this.recScreenStream = null;
|
||||||
this._isRecording = false;
|
this._isRecording = false;
|
||||||
@@ -1600,6 +1601,9 @@ class RoomClient {
|
|||||||
if (this.producerLabel.has(mediaType.audioTab)) {
|
if (this.producerLabel.has(mediaType.audioTab)) {
|
||||||
return console.log('Producer already exists for this type ' + mediaType.audioTab);
|
return console.log('Producer already exists for this type ' + mediaType.audioTab);
|
||||||
}
|
}
|
||||||
|
const audioTabStream = new MediaStream();
|
||||||
|
audioTabStream.addTrack(stream.getAudioTracks()[0]);
|
||||||
|
this.localScreenAudioTabStream = audioTabStream;
|
||||||
|
|
||||||
const track = stream.getAudioTracks()[0];
|
const track = stream.getAudioTracks()[0];
|
||||||
const params = {
|
const params = {
|
||||||
@@ -3305,20 +3309,16 @@ class RoomClient {
|
|||||||
try {
|
try {
|
||||||
this.audioRecorder = new MixedAudioRecorder();
|
this.audioRecorder = new MixedAudioRecorder();
|
||||||
const audioStreams = this.getAudioStreamFromAudioElements();
|
const audioStreams = this.getAudioStreamFromAudioElements();
|
||||||
|
console.log('Audio streams tracks --->', audioStreams.getTracks());
|
||||||
const audioMixerStreams = this.audioRecorder.getMixedAudioStream([audioStreams, this.localAudioStream]);
|
const audioMixerStreams = this.audioRecorder.getMixedAudioStream([audioStreams, this.localAudioStream]);
|
||||||
const audioMixerTracks = audioMixerStreams.getTracks();
|
const audioMixerTracks = audioMixerStreams.getTracks();
|
||||||
|
console.log('Audio mixer tracks --->', audioMixerTracks);
|
||||||
if (this.isMobileDevice) {
|
if (this.isMobileDevice) {
|
||||||
const videoTracks = this.localVideoStream.getTracks();
|
|
||||||
console.log('INIT CAM RECORDING', {
|
|
||||||
localAudioStream: this.localAudioStream,
|
|
||||||
localVideoStream: this.localVideoStream,
|
|
||||||
videoTracks: videoTracks,
|
|
||||||
audioMixerTracks: audioMixerTracks,
|
|
||||||
});
|
|
||||||
// on mobile devices recording camera + all audio tracks
|
// on mobile devices recording camera + all audio tracks
|
||||||
|
const videoTracks = this.localVideoStream.getTracks();
|
||||||
|
console.log('Cam video tracks --->', videoTracks);
|
||||||
let newStream = new MediaStream([...videoTracks, ...audioMixerTracks]);
|
let newStream = new MediaStream([...videoTracks, ...audioMixerTracks]);
|
||||||
console.log('New Cam Media Stream ---> ', newStream.getTracks());
|
console.log('New Cam Media Stream tracks --->', newStream.getTracks());
|
||||||
this.mediaRecorder = new MediaRecorder(newStream, options);
|
this.mediaRecorder = new MediaRecorder(newStream, options);
|
||||||
console.log('Created MediaRecorder', this.mediaRecorder, 'with options', options);
|
console.log('Created MediaRecorder', this.mediaRecorder, 'with options', options);
|
||||||
this.getId('swapCameraButton').className = 'hidden';
|
this.getId('swapCameraButton').className = 'hidden';
|
||||||
@@ -3333,14 +3333,9 @@ class RoomClient {
|
|||||||
.getDisplayMedia(constraints)
|
.getDisplayMedia(constraints)
|
||||||
.then((screenStream) => {
|
.then((screenStream) => {
|
||||||
const screenTracks = screenStream.getTracks();
|
const screenTracks = screenStream.getTracks();
|
||||||
console.log('INIT SCREEN - WINDOW RECORDING', {
|
console.log('Screen video tracks --->', screenTracks);
|
||||||
localAudioStream: this.localAudioStream,
|
|
||||||
localVideoStream: this.localVideoStream,
|
|
||||||
screenTracks: screenTracks,
|
|
||||||
audioMixerTracks: audioMixerTracks,
|
|
||||||
});
|
|
||||||
this.recScreenStream = new MediaStream([...screenTracks, ...audioMixerTracks]);
|
this.recScreenStream = new MediaStream([...screenTracks, ...audioMixerTracks]);
|
||||||
console.log('New Screen/Window Media Stream ---> ', this.recScreenStream.getTracks());
|
console.log('New Screen/Window Media Stream tracks --->', this.recScreenStream.getTracks());
|
||||||
this.mediaRecorder = new MediaRecorder(this.recScreenStream, options);
|
this.mediaRecorder = new MediaRecorder(this.recScreenStream, options);
|
||||||
console.log('Created MediaRecorder', this.mediaRecorder, 'with options', options);
|
console.log('Created MediaRecorder', this.mediaRecorder, 'with options', options);
|
||||||
this._isRecording = true;
|
this._isRecording = true;
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم