From cc91f101031c66c0bf17f51a683d045977ab7158 Mon Sep 17 00:00:00 2001 From: Dw9 Date: Sat, 12 Mar 2022 19:21:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=AD=E9=9F=B3?= =?UTF-8?q?=E9=A2=91=E6=97=A0=E6=B3=95=E8=BF=9B=E8=A1=8Cwebrtc=20echo?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=9A=84bug=20(#1493)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/ZLMRTCClient.js | 19 +++++++++++-------- www/webrtc/ZLMRTCClient.js | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/www/ZLMRTCClient.js b/www/ZLMRTCClient.js index fadf9c9b2d..b218541962 100644 --- a/www/ZLMRTCClient.js +++ b/www/ZLMRTCClient.js @@ -7418,20 +7418,23 @@ var ZLMRTCClient = (function (exports) { scaleResolutionDownBy: 4 }]; } - - if (stream.getAudioTracks().length > 0) { - this.pc.addTransceiver(stream.getAudioTracks()[0], AudioTransceiverInit); - } else { - AudioTransceiverInit.direction = 'recvonly'; - this.pc.addTransceiver('audio', AudioTransceiverInit); - } - + if (this.options.audioEnable){ + if (stream.getAudioTracks().length > 0) { + this.pc.addTransceiver(stream.getAudioTracks()[0], AudioTransceiverInit); + } else { + AudioTransceiverInit.direction = 'recvonly'; + this.pc.addTransceiver('audio', AudioTransceiverInit); + } + } + + if (this.options.videoEnable){ if (stream.getVideoTracks().length > 0) { this.pc.addTransceiver(stream.getVideoTracks()[0], VideoTransceiverInit); } else { VideoTransceiverInit.direction = 'recvonly'; this.pc.addTransceiver('video', VideoTransceiverInit); } + } /* stream.getTracks().forEach((track,idx)=>{ debug.log(this.TAG,track); diff --git a/www/webrtc/ZLMRTCClient.js b/www/webrtc/ZLMRTCClient.js index fadf9c9b2d..b218541962 100644 --- a/www/webrtc/ZLMRTCClient.js +++ b/www/webrtc/ZLMRTCClient.js @@ -7418,20 +7418,23 @@ var ZLMRTCClient = (function (exports) { scaleResolutionDownBy: 4 }]; } - - if (stream.getAudioTracks().length > 0) { - this.pc.addTransceiver(stream.getAudioTracks()[0], AudioTransceiverInit); - } else { - AudioTransceiverInit.direction = 'recvonly'; - this.pc.addTransceiver('audio', AudioTransceiverInit); - } - + if (this.options.audioEnable){ + if (stream.getAudioTracks().length > 0) { + this.pc.addTransceiver(stream.getAudioTracks()[0], AudioTransceiverInit); + } else { + AudioTransceiverInit.direction = 'recvonly'; + this.pc.addTransceiver('audio', AudioTransceiverInit); + } + } + + if (this.options.videoEnable){ if (stream.getVideoTracks().length > 0) { this.pc.addTransceiver(stream.getVideoTracks()[0], VideoTransceiverInit); } else { VideoTransceiverInit.direction = 'recvonly'; this.pc.addTransceiver('video', VideoTransceiverInit); } + } /* stream.getTracks().forEach((track,idx)=>{ debug.log(this.TAG,track);