相关疑难解决方法(0)

Firefox 中的 WebRTC OfferToReceiveAudio 错误

我正在开发一个简单的示例来测试 WebRTC,我发现了以下奇怪的行为。

使用 Chrome 时,媒体约束指定为:

mediaConstraints = {'mandatory': {'OfferToReceiveAudio':true, 'OfferToReceiveVideo':true}};
Run Code Online (Sandbox Code Playgroud)

这工作正常。

但是,当使用 Firefox(Mac 上的 35.0.1)时,根据规范,它应该是:

mediaConstraints = {'offerToReceiveAudio':true,'offerToReceiveVideo':true};
Run Code Online (Sandbox Code Playgroud)

但不起作用(Ice 失败了!)

使用“ Ø fferToReceiveAudio”

mediaConstraints = {'OfferToReceiveAudio':true,'offerToReceiveVideo':true};
Run Code Online (Sandbox Code Playgroud)

工作正常。

这是记录在案的行为吗?

firefox google-chrome webrtc

4
推荐指数
1
解决办法
3325
查看次数

如何解决RTCIceServer.url已弃用!使用网址代替?

我用soket.io安装了nodejs.想要将此代码测试到服务器节点server.js

var static = require('node-static');
var http = require('http');
// Create a node-static server instance listening on port 8181
var file = new(static.Server)();
// We use the http module’s createServer function and
// use our instance of node-static to serve the files
var app = http.createServer(function (req, res) {
file.serve(req, res);
}).listen(8181);
// Use socket.io JavaScript library for real-time web applications
var io = require('socket.io').listen(app);
// Let's start managing connections...
io.sockets.on('connection', function (socket){
// Handle 'message' messages
socket.on('message', function (message) …
Run Code Online (Sandbox Code Playgroud)

node.js socket.io webrtc

4
推荐指数
1
解决办法
4140
查看次数

WebRTC永远不会触发onCandidate

我开始使用WebRTC开发,但那件事从来没有给我ICE候选人.我设置了所有内容,我正在交换描述和内容,我还在那里缩小了一个超级丑陋的功能,以确保一切都正常运行,一个接一个.信号状态对两者都是稳定的,onError永远不会被触发(如预期的那样),但onIceCandidate也是(不是预期的),当我想发送一个随机的空MediaStream对象时pc1.addStream(new webkitMediaStream());,它总是触发onNegotiationNeeded.

有没有人知道我的代码到底有什么问题?我花了几个小时浏览Stack Overflow,HTML5 Rocks和W3C文档,但我不明白.这是我的整个代码:

var config={
  'iceServers':[{
    'url':'stun:stun.l.google.com:19302'
  },{
    'url':'stun:stun1.l.google.com:19302'
  },{
    'url':'stun:stun2.l.google.com:19302'
  },{
    'url':'stun:stun3.l.google.com:19302'
  },{
    'url':'stun:stun4.l.google.com:19302'
  }]
};
var pc1=new webkitRTCPeerConnection(config);
var pc2=new webkitRTCPeerConnection(config);

var onError=function(error)
{
  console.error(error);
}

pc1.onicecandidate=function()
{
  console.log('PC1 onIceCandidate (finally) fired!');
}
pc2.onicecandidate=function()
{
  console.log('PC2 onIceCandidate (finally) fired!');
}

pc1.oniceconnectionstatechange=function()
{
  console.log('PC1 oniceconnectionstatechange fired!');
}
pc2.oniceconnectionstatechange=function()
{
  console.log('PC2 oniceconnectionstatechange fired!');
}
pc1.onnegotiationneeded=function()
{
  console.log('PC1 onnegotiationneeded fired!');
}
pc2.onnegotiationneeded=function()
{
  console.log('PC2 onnegotiationneeded fired!');
}

pc1.createOffer(function(offer){
  pc1.setLocalDescription(offer,function(){
    pc2.setRemoteDescription(new RTCSessionDescription(offer),function(){
      pc2.createAnswer(function(answer){
        pc2.setLocalDescription(answer,function(){ …
Run Code Online (Sandbox Code Playgroud)

javascript webrtc

3
推荐指数
3
解决办法
3877
查看次数

从父承诺中解决一系列承诺

这是我对嵌套诺言的第一枪。我使用的是bluebird库,但我认为对于所有的Promise库都是相同的。

从高层次上讲,这就是我想要做的:

myService.getSomeData(url)
 .then((data) => {
   myOtherService.getMoreData(data.uniqueId)
   .then((thisDataIsAnArray) => {
      //loop over the data above and do something
   });
 });
Run Code Online (Sandbox Code Playgroud)

getMoreData()应该进行X次服务调用并将结果存储在X个元素数组中。这是我开始迷路的地方,因为我不确定如何制作此方法以及应该从中得到什么。我已经在蓝鸟那里taken了几口Promise.allPromise.map但是却挣扎了,以为我会征求建议。

javascript promise bluebird

2
推荐指数
1
解决办法
1346
查看次数