我正在致力于在我的系统上集成easyrtc。目前,我可以进行音频和视频呼叫。但过了一段时间,我能听到我自己的声音,而且有一个明显的延迟。我用chrome:webrtc-internals查看了chrome,在回声消除技术中似乎没有输入。How can I enable it?谢谢你。如果还有更多的需求
我们的集成代码:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ page session="true" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html lang="de">
<head>
<jsp:include page="../common/meta.jsp"/>
<title> <spring:message code="meta.title.videochat"/></title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/easyrtc.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/jquery-ui.css">
</head>
<body class="stream-view">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/resources/js/plugins/jquery-2.1.4.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript" src="https://www.OUR_APP.com:PORT/socket.io/socket.io.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/easyrtc/easyrtc.js?version=${appVersionNumber}"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/easyrtc/easyrtc_rates.js?version=${appVersionNumber}"></script>
var activeBox = -1; // nothing selected
var aspectRatio = 4/3; // standard definition video aspect ratio
var maxCALLERS = 5;
var numVideoOBJS = maxCALLERS;
var layout;
var microphone = true;
var camera = true;
var getURLParameter = function(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
};
var personal = getURLParameter("p");
var group = getURLParameter("g");
easyrtc.setSocketUrl("https://www.OUR_APP.com:PORT");
easyrtc.dontAddCloseButtons(true);发布于 2017-07-18 02:41:30
“噪音消除”和“能听到自己的声音”是不同的东西。
第一种称为噪声抑制。后者被称为AEC (声学回声消除)。
在Chrome中,你可以通过指定mediaConstraints来设置它们,但我认为默认情况下它们是打开的:
var mediaConstraints = {
audio: {
echoCancellation: { exact: true },
googEchoCancellation: { exact: true},
googAutoGainControl: { exact: true},
googNoiseSuppression: { exact: true},
}
}在Firefox中,你需要使用"moz“前缀,而不是"goog”。
发布于 2020-07-31 11:05:48
为了扩展给定的答案,这有助于作为起点,但没有解释easyrtc中的实现:
我已经开始讨论open-easyrtc上的拉取请求了,但现在我已经用一行更新破解了我自己的分支:
(请注意,我在这里发布了整个函数,但实际的更改很小,如注释所示--查找'START FORK')
self.getUserMediaConstraints = function() {
var constraints = {};
//
// _presetMediaConstraints allow you to provide your own constraints to be used
// with initMediaSource.
//
if (self._presetMediaConstraints) {
constraints = self._presetMediaConstraints;
delete self._presetMediaConstraints;
return constraints;
} else if (!self.videoEnabled) {
constraints.video = false;
}
else {
// Tested Firefox 49 and MS Edge require minFrameRate and maxFrameRate
// instead max,min,ideal that cause GetUserMedia failure.
// Until confirmed both browser support idea,max and min we need this.
if (
adapter && adapter.browserDetails &&
(adapter.browserDetails.browser === "firefox" || adapter.browserDetails.browser === "edge")
) {
constraints.video = {};
if (self._desiredVideoProperties.width) {
constraints.video.width = self._desiredVideoProperties.width;
}
if (self._desiredVideoProperties.height) {
constraints.video.height = self._desiredVideoProperties.height;
}
if (self._desiredVideoProperties.frameRate) {
constraints.video.frameRate = {
minFrameRate: self._desiredVideoProperties.frameRate,
maxFrameRate: self._desiredVideoProperties.frameRate
};
}
if (self._desiredVideoProperties.videoSrcId) {
constraints.video.deviceId = self._desiredVideoProperties.videoSrcId;
}
// chrome and opera
} else {
constraints.video = {};
if (self._desiredVideoProperties.width) {
constraints.video.width = {
max: self._desiredVideoProperties.width,
min : self._desiredVideoProperties.width,
ideal : self._desiredVideoProperties.width
};
}
if (self._desiredVideoProperties.height) {
constraints.video.height = {
max: self._desiredVideoProperties.height,
min: self._desiredVideoProperties.height,
ideal: self._desiredVideoProperties.height
};
}
if (self._desiredVideoProperties.frameRate) {
constraints.video.frameRate = {
max: self._desiredVideoProperties.frameRate,
ideal: self._desiredVideoProperties.frameRate
};
}
if (self._desiredVideoProperties.videoSrcId) {
constraints.video.deviceId = self._desiredVideoProperties.videoSrcId;
}
// hack for opera
if (Object.keys(constraints.video).length === 0 ) {
constraints.video = true;
}
}
}
if (!self.audioEnabled) {
constraints.audio = false;
}
else {
// START FORK FOR ECHO CANCELLATION
//
//
// see: https://github.com/open-easyrtc/open-easyrtc/issues/47
// constraints.audio = {};
constraints.audio = {
sampleSize: 8,
echoCancellation: true,
};
//
// END FORK
//
if (self._desiredAudioProperties.audioSrcId) {
// constraints.audio.deviceId = {exact: self._desiredAudioProperties.audioSrcId};
constraints.audio.deviceId = self._desiredAudioProperties.audioSrcId;
}
}
console.log("CONSTRAINTS", constraints)
return constraints;
};这是一种短期的补丁方式。理想情况下,open-easyrtc将来会有办法随意添加像这样的特性标志。
如果您不打算实现自己的open-easyrtc分支,则需要使用self._presetMediaConstraints。但是,这将排除此函数中的所有逻辑,并排除使用easyrtc.enableAudio等函数,如果我没有记错的话,这需要您自己完成所有这些操作,或者只是复制/粘贴此代码并让这些乱七八糟的东西四处漂浮(正如您在此答案中看到的,此代码可能会在未来发生变化,您不会看到或受益于这些更新)。从长远来看,这可能是我会走的路线,但我在客户端的时间/预算有限,而且已经有了与easyrtc中的默认代码路径一起工作的现有逻辑,所以我不想开始搞得一团糟来重写所有这些。
但是,如果你要走这条路,你会这样做
easyrtc._presetMediaConstraints = {
audio: {
sampleSize: 8,
echoCancellation: true
}
}https://stackoverflow.com/questions/45055657
复制相似问题