简体   繁体   English

使用 webRtcPeer 连接将 Kurento 中的音频静音/取消静音

[英]Mute/Unmute audio in Kurento with webRtcPeer connection

I am able to make video call between two individuals but now what I wanted to do is that I want to add a button to mute and unmute the audio while streaming video I search a lot on the internet but nothing works out for me.我能够在两个人之间进行视频通话,但现在我想要做的是我想添加一个按钮来静音和取消静音,同时流式传输视频我在互联网上搜索了很多,但对我来说没有任何效果。

then I found the configuration in options property of WebRtcPeerSendrecv which enables audio on connection but the problem is how I update or toggle it during the stream.然后我在WebRtcPeerSendrecv 的options 属性中找到了配置,它在连接时启用音频,但问题是我如何在流期间更新或切换它。

here is my code这是我的代码

 var videoInput = document.getElementById('videoInput');
 var videoOutput = document.getElementById('videoOutput');

 var constraints = {
   audio: true, //how do I toggle this during the stream.
   video: {
     width: 640,
     framerate: 15
   }
 };

var options = {
  localVideo: videoInput,
  remoteVideo: videoOutput,
  onicecandidate : onIceCandidate,
  mediaConstraints: constraints
};


var webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
  if(error) return onError(error)

  this.generateOffer(onOffer)
});

I am also free for another alternative which helps me to integrate mute/unmute functionality in my stream.我也有免费的另一种选择,它帮助我在我的流中集成静音/取消静音功能。

I am stuck at this so bad for so long any kind of help is appreciable thanks in advance.我被困在这个问题上很长时间了,任何形式的帮助都是可观的,提前致谢。

我发现解决方案在建立对等连接后 webRtcPeer 中有一个属性,它允许我们操纵视频流audioEnabled这是一个布尔值我所做的是我只是按照我的要求将其值更改为 true/false

webRtcPeer.audioEnabled = false //by default it will be false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM