我在让mediasoup_v3_example正常工作时遇到问题。
我已经创建了一个远程服务器并部署了代码。从终端看起来一切都很好,我可以看到客户端正在连接。我可以加载“html”页面并启动媒体,我可以点击发布,但每当人们订阅时,他们只会收到一个空框。
我正在使用 Ubuntu 笔记本电脑、Macbook 和 Android 手机进行测试。
这是仅尝试运行广播示例的输出
$ node mediasoup_v3_broadcast.js
socket.io server start. port=443
Web server start. https://178.128.128.151:443/
client connected. socket id=4LBBs9SvfrcviWiwAAAA , total clients=1
-- mediasoup worker start. --
client connected. socket id=9qXXNU8yctWouTFGAAAB , total clients=2
getRouterRtpCapabilities: {
codecs: [
{
kind: 'audio',
mimeType: 'audio/opus',
clockRate: 48000,
channels: 2,
preferredPayloadType: 100,
parameters: {},
rtcpFeedback: []
},
{
kind: 'video',
mimeType: 'video/VP8',
clockRate: 90000,
rtcpFeedback: [Array],
preferredPayloadType: 101,
parameters: [Object]
},
{
kind: 'video',
mimeType: 'video/rtx',
preferredPayloadType: 102,
clockRate: 90000,
rtcpFeedback: [],
parameters: [Object]
}
],
headerExtensions: [
{
kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id',
preferredId: 2,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
preferredId: 3,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'audio',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'audio',
uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
preferredId: 5,
preferredEncrypt: false,
direction: 'inactive'
},
{
kind: 'video',
uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
preferredId: 5,
preferredEncrypt: false,
direction: 'inactive'
},
{
kind: 'video',
uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
preferredId: 6,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:framemarking',
preferredId: 7,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level',
preferredId: 10,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:3gpp:video-orientation',
preferredId: 11,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:toffset',
preferredId: 12,
preferredEncrypt: false,
direction: 'sendrecv'
}
],
fecMechanisms: []
}
-- createProducerTransport ---
-- create transport id=ceefb300-f62f-4c81-8420-a3ed26f4368f
-- produce --- kind= video
--broadcast newProducer -- kind= video
-- produce --- kind= audio
--broadcast newProducer -- kind= audio
client connected. socket id=IQUc9QQR6WNRghJFAAAC , total clients=3
getRouterRtpCapabilities: {
codecs: [
{
kind: 'audio',
mimeType: 'audio/opus',
clockRate: 48000,
channels: 2,
preferredPayloadType: 100,
parameters: {},
rtcpFeedback: []
},
{
kind: 'video',
mimeType: 'video/VP8',
clockRate: 90000,
rtcpFeedback: [Array],
preferredPayloadType: 101,
parameters: [Object]
},
{
kind: 'video',
mimeType: 'video/rtx',
preferredPayloadType: 102,
clockRate: 90000,
rtcpFeedback: [],
parameters: [Object]
}
],
headerExtensions: [
{
kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:mid',
preferredId: 1,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id',
preferredId: 2,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
preferredId: 3,
preferredEncrypt: false,
direction: 'recvonly'
},
{
kind: 'audio',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
preferredId: 4,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'audio',
uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
preferredId: 5,
preferredEncrypt: false,
direction: 'inactive'
},
{
kind: 'video',
uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
preferredId: 5,
preferredEncrypt: false,
direction: 'inactive'
},
{
kind: 'video',
uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
preferredId: 6,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:framemarking',
preferredId: 7,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'audio',
uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level',
preferredId: 10,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:3gpp:video-orientation',
preferredId: 11,
preferredEncrypt: false,
direction: 'sendrecv'
},
{
kind: 'video',
uri: 'urn:ietf:params:rtp-hdrext:toffset',
preferredId: 12,
preferredEncrypt: false,
direction: 'sendrecv'
}
],
fecMechanisms: []
}
-- createConsumerTransport ---
-- create transport id=0b864841-16bf-41dd-b2e5-d18c1798a167
consumerTransports count=1
-- consume --kind=video
videoConsumers count=1
-- consumer ready ---
-- connectConsumerTransport ---
-- resume -- kind=video
-- consume --kind=audio
audioConsumers count=1
-- consumer ready ---
这是客户端控制台
=== ready ===
subscribe.html:65 socket.io connected()
subscribe.html:75 socket.io message: {type: "welcome", id: "G2flbGkugzd7U6CJAAAH"}
subscribe.html:82 connected to server. clientId=G2flbGkugzd7U6CJAAAH
subscribe.html:265 getRouterRtpCapabilities: {codecs: Array(3), headerExtensions: Array(13), fecMechanisms: Array(0)}
subscribe.html:272 --- createConsumerTransport --
subscribe.html:274 transport params: {id: "f059ade3-782b-4025-864b-9ffce694634b", iceParameters: {…}, iceCandidates: Array(2), dtlsParameters: {…}}
subscribe.html:276 createConsumerTransport: Transport {_events: {…}, _eventsCount: 0, _maxListeners: Infinity, _logger: Logger, _id: "f059ade3-782b-4025-864b-9ffce694634b", …}
subscribe.html:383 --start of consume --kind=video
subscribe.html:290 --consumer trasnport connect
subscribe.html:301 subscribing...
subscribe.html:411 --end of consume
subscribe.html:327 -- track exist, consumer ready. kind=video
subscribe.html:330 -- resume kind=video
subscribe.html:383 --start of consume --kind=audio
subscribe.html:333 resume OK
subscribe.html:411 --end of consume
subscribe.html:327 -- track exist, consumer ready. kind=audio
subscribe.html:342 -- do not resume kind=audio
subscribe.html:309 failed
我还将服务器文件的顶部更改为
const fs = require('fs');
let serverOptions = {
hostName: "178.128.128.151",
listenPort: 443,
useHttps: true,
httpsKeyFile:"../MyKeyFile",
httpsCertFile:"../MyCertFile",
};
let sslOptions = {};
if (serverOptions.useHttps) {
sslOptions.key = fs.readFileSync(serverOptions.httpsKeyFile).toString();
sslOptions.cert = fs.readFileSync(serverOptions.httpsCertFile).toString();
}
感谢您的任何帮助/想法