- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的webRTC项目有问题。我的代码在Chrome和Firefox直到版本52之前都可以正常运行。自Firefox 53以来,我收到以下错误消息:“ICE失败,请参阅about:webrtc了解更多详细信息”。这是我的代码:
let connection;
let dataChannel;
const initCon = (initiatorBoolean, choosenONE) => {
createConnection();
startConnection(initiatorBoolean, choosenONE);
console.log('initCon(' + initiatorBoolean + ') / choosenONE = ' +choosenONE);
}
var boolJoin = false;
var lobbies = [];
var me = prompt("Please enter your name", "Bert");
// Helper für das Errorlogging
const logErrors = err => console.log(err);
// Websockets-Verbindung herstellen
const socket = io.connect('http://7daysclub.de:8080');
/* Methode to send information between to Users
*@param
*receiver= User who get the message
*type= Type of the message: could be init, joined, getUsers, setUsers, offer, answer, candidate
*descr= Content of the message
*/
const sendMessage = (receiver, type, descr) => {
message = Object.assign({to: 'default'}, {
user: receiver,
type: type,
descr: descr,
from: me
});
socket.emit('message', message);
console.log("send: " + message.type + ". to: " + message.user);
};
const createConnection = () => {
//Verbindung erstellen
connection = new RTCPeerConnection( {
'iceServers': [
{
/*
'urls': 'stun:stun.l.google.com:19302'
*/
'urls': 'stun:185.223.29.90:3478'
},
{
'urls': 'turn:185.223.29.90:3478',
'credential': '***',
'username': '***'
}
]
});
connection.oniceconnectionstatechange = function(event) {
console.log('state: '+connection.iceConnectionState );
if (connection.iceConnectionState === "failed" ||
connection.iceConnectionState === "disconnected" ||
connection.iceConnectionState === "closed") {
// Handle the failure
}
};
}
const call = choosenONE => {
if (!boolJoin) {
sendMessage(choosenONE, 'joined', null);
}
};
// Nachricht vom Signaling-Kanal empfangen
const receiveMessage = message => {
console.log("receive: " + message.type);
//Filter messages
if (message.user != 'all' && message.user != me) {
console.log("Block= " + message.user);
return;
}
// Nachricht verarbeiten
switch (message.type) {
// Partner ist verfügbar
case 'joined':
choosenONE = message.from;
sendMessage( choosenONE, 'init', null);
boolJoin = true;
initCon(true, choosenONE);
break;
case 'getUsers':
sendMessage(message.from,'setUsers', null)
lobbies.push(message.from);
lobbylist();
console.log('add User: ' + lobbies[lobbies.length-1] + ' to List');
break;
case 'setUsers':
lobbies.push(message.from);
console.log('add User: ' + lobbies[lobbies.length-1] + ' to List');
lobbylist();
break;
// Verbindungsaufbau wurde vom Partner angefordert
case 'init':
choosenONE = message.from;
boolJoin = true;
initCon(false, choosenONE);
break;
// Ein SDP-Verbindungsangebot ist eingegangen – wir erstellen eine Antwort
case 'offer':
connection
.setRemoteDescription(new RTCSessionDescription(message.descr))
.then(() => connection.createAnswer())
.then(answer => connection.setLocalDescription(new RTCSessionDescription(answer)))
.then(() => sendMessage(message.from,'answer', connection.localDescription, me))
.catch(logErrors);
break;
// Eine SDP-Verbindungsantwort auf unsere Anfrage ist eingegangen.
case 'answer':
connection.setRemoteDescription(new RTCSessionDescription(message.descr));
break;
// Der Partner hat eine mögliche Host-Port-Kombination ("ICE Candidate") gefunden
case 'candidate':
connection.addIceCandidate(new RTCIceCandidate({candidate: message.descr}));
break;
}
};
socket.on('message', receiveMessage);
// Verbindung initialisieren
const startConnection = (isCreator, choosenONE) => {
// Wenn wir mögliche Kommunikationsendpunkte finden, diese an den Partner weitergeben
connection.onicecandidate = event => {
if (event.candidate) {
sendMessage(choosenONE, 'candidate', event.candidate.candidate);
}
};
// Wenn die Gegenseite einen Stream hinzufügt, diesen an das video-element hängen
connection.ontrack = (e) => {
document.getElementById('vidRemote').src = window.URL.createObjectURL(e.stream);
};
// Falls wir der erste Teilnehmer sind, starten wir den Verbindungsaufbau
if (isCreator) {
// Datenkanal anlegen
dataChannel = connection.createDataChannel('chat');
onDataChannelCreated(dataChannel);
connection
.createOffer()
.then(offer => connection.setLocalDescription(new RTCSessionDescription(offer)))
.then(() => sendMessage(choosenONE, 'offer', connection.localDescription))
.catch(logErrors);
} else {
// Wenn wir nicht der Initiator sind, reagieren wir nur auf das Anlegen eines Datenkanals
connection.ondatachannel = function (event) {
dataChannel = event.channel;
onDataChannelCreated(dataChannel);
};
}
};
const onDataChannelCreated = (channel, choosenONE) => {
// Sobald der Datenkanal verfügbar ist, Chateingaben zulassen
channel.onopen = () => {
const enterChat = document.getElementById('enterChat');
enterChat.disabled = false;
enterChat.onkeyup = (keyevent) => {
// Bei "Enter" absenden
if (keyevent.keyCode === 13) {
dataChannel.send(enterChat.value);
appendChatMessage(me+':', enterChat.value);
enterChat.value = '';
}
}
};
channel.onmessage = (message) => appendChatMessage(choosenONE+':', message.data);
};
const appendChatMessage = (name, text) => {
const displayChat = document.getElementById('displayChat');
const time = new Date().toString('H:i:s');
displayChat.innerHTML = `<p>${name} - ${time}<br>${text}</p>` + displayChat.innerHTML;
};
function lobbylist() {
allusers = "";
lobbies.forEach( element => {
allusers += "<li><button onclick=\"call('"+element+"')\">"+element+"</button></li>"
});
document.getElementById('lobbylist').innerHTML = allusers;
}
//Alle User bei Ankunft erfragen
sendMessage('all','getUsers', null);
lobbylist();
# TURN listener port for UDP and TCP (Default: 3478).
# Note: actually, TLS & DTLS sessions can connect to the
# "plain" TCP & UDP port(s), too - if allowed by configuration.
#
listening-port=3478
# TURN listener port for TLS (Default: 5349).
# Note: actually, "plain" TCP & UDP sessions can connect to the TLS & DTLS
# port(s), too - if allowed by configuration. The TURN server
# "automatically" recognizes the type of traffic. Actually, two listening
# endpoints (the "plain" one and the "tls" one) are equivalent in terms of
# functionality; but we keep both endpoints to satisfy the RFC 5766 specs.
# For secure TCP connections, we currently support SSL version 3 and
# TLS version 1.0, 1.1 and 1.2. SSL2 "encapculation mode" is also supported.
# For secure UDP connections, we support DTLS version 1.
#
tls-listening-port=5349
# Listener IP address of relay server. Multiple listeners can be specified.
# If no IP(s) specified in the config file or in the command line options,
# then all IPv4 and IPv6 system IPs will be used for listening.
#
listening-ip=185.223.29.90
# Relay address (the local IP address that will be used to relay the
# packets to the peer).
# Multiple relay addresses may be used.
# The same IP(s) can be used as both listening IP(s) and relay IP(s).
#
# If no relay IP(s) specified, then the turnserver will apply the default
# policy: it will decide itself which relay addresses to be used, and it
# will always be using the client socket IP address as the relay IP address
# of the TURN session (if the requested relay address family is the same
# as the family of the client socket).
#
relay-ip=185.223.29.90
lt-cred-mech
# Realm for long-term credentials mechanism and for TURN REST API.
#
realm=7daysclub.de
#Local system IP address to be used for CLI server endpoint. Default value
# is 127.0.0.1.
#
cli-ip=185.223.29.90
# CLI server port. Default is 5766.
#
cli-port=5766
最佳答案
查看您的在线演示,远程SDP中没有候选人行,这表明该候选人从未添加。
这将丢弃需要通过信号发送到远程对等方的sdpMid和sdpMLineIndex。将.catch添加到您的addIceCandidate以记录任何错误。
sendMessage(choosenONE, 'candidate', event.candidate.candidate);
关于webrtc - WebRTC:自Firefox v 53起,ICE失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47612137/
是WebRTC Web 开发人员可以免费在网页上设置视频通话吗?为什么 Twilio 的视频通话定价为每分钟 25 美分,在网络托管服务器上管理视频通话对小家伙来说会不会太贵了? 任何深入 WebRT
webRTC 是根据 https://apprtc.appspot.com/ 实现的 PeerConnection webRTC 如何实现远程音视频流的同步? 最佳答案 使用 RTCP SR/RR 报
我正在尝试使用 webRTC,似乎对每条消息中可以发送的字节数有任意限制。 This guy我使用的示例选择了 100(加上一些)字节的限制。在我的测试中,它似乎接近 200 字节。但是从阅读 TCP
我目前正在测试 WebRTC 的功能,但我有一些脑逻辑问题。 WebRTC 究竟是什么? 我只读了“STUN”、“P2P”和其他...但是在技术方面什么是正确的 WebRTC(见下一个) 我需要什么
我目前正在使用 opentok 构建实时视频聊天医疗保健应用程序api,其技术主要建立在 WebRTC 上,并想知道如何处理整体安全方面。 最佳答案 简而言之,是的。所有 WebRTC 媒体流都经过加
WebRTC Reference App --> var errorMessages = []; var channelToken = 'AHRlWroGHj6YqW
我对浏览器中的点对点连接感兴趣。由于这对于 WebRTC 来说似乎是可能的,我想知道它是如何精确工作的。 我已经阅读了一些解释并看到了相关图表,现在我很清楚,连接建立是通过服务器进行的。服务器似乎在愿
我是 WebRTC 的初学者,我想知道是否需要导入任何内容才能使用 JavaScript API。 最佳答案 不,您不需要导入任何库。 webRTC 包含在 Chrome 和 Firefox 中(以及
我正在使用 WebRTC 来开发我的应用程序之一。 WebRTC 是否原生支持视频数据包的自适应比特率流,目前尚不清楚? VP8/VP9 是否支持自适应比特率编码? bitrate_controlle
是否可以通过 webRTC 捕获桌面屏幕共享。我们知道它只是捕获浏览器选项卡上的屏幕,但是否可以捕获整个桌面屏幕,例如浏览计算机上的文件或打开和查看文件,例如pdf等.. 最佳答案 目前,RTCWeb
我可以有两个单独的服务器用于托管和发送信号吗?还是仅在托管服务器中配置信令服务器更好? 最佳答案 托管 webrtc 信令服务器没有具体限制。如果需要,您可以将信令服务器与 Web 应用程序服务器分开
我想知道 WebRTC api 是否会自动更改带宽以增加体验。据我所知,WebRTC 具有更改和限制最大值的功能。带宽如我们所愿。我寻求答案的问题是我们应该手动执行此操作还是 WebRTC 无论如何都
如果在本地网络中的两个对等方之间建立了 WebRTC 连接,我们可以在失去与互联网的连接后维持它吗?这似乎是可能的,因为它是点对点的。 最佳答案 是的,有可能。对等方使用同一网络中的专用 IP 地址直
我正在尝试创建一个应用程序,该应用程序要求用户使用 webRTC 将其本地视频流发送到多个对等方。据我所知,我负责管理多个 PeerConnection 对象,因为 PeerConnection 一次
我想创建自己的视频聊天应用程序。我使用 WebRTC 框架。我阅读了一些教程,每个主题都假定存在信令 channel 。如何实现自己的信令 channel ? 最佳答案 由于目前没有为 WebRTC
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 6年前关闭。 Improve this qu
假设我有 2 个同行与 webRTC 交换视频。现在我需要将两个流都保存为中央服务器中的视频文件。是否可以实时进行? (存储/上传来自同行的视频不是一种选择)。 我想建立一个 3 节点 webRTC
WebRTC 信号让我发疯。我的用例非常简单:信息亭和控制室 webapp 之间的双向音频对讲。两台计算机都在同一个网络上。两者都没有互联网访问权限,所有机器都有已知的静态 IP。 我阅读的所有内容都
我知道我可以将宽度和高度设置为本地视频的约束。但是,我不确定如何通过 RTCPeerConnection 获取远程视频的宽度和高度。我用谷歌搜索了很多,但似乎没有得到任何有用的信息。我认为这应该是一个
我是 WebRTC 的新手,并试图弄清楚如何在浏览器之外创建一个程序,该程序接收 WebRTC 音频流并将其输出到扬声器上。 是否有适用于 Java 或 C# 的 WebRTC 库? 该接收器将在 l
我是一名优秀的程序员,十分优秀!