请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

本地部署无法查看对方的视频

李超老师,我使用 windows 下的Linux 部署了Demo,无法查看对方的视频。这个问题怎么排查呢。增加了listenIps配置。

webRtcTransportOptions: {
                        listenIps : [
                                {ip : '0.0.0.0',announcedIp:null}
                        ],

                        initialAvailableOutgoingBitrate: 1000000,
                        minimumAvailableOutgoingBitrate: 600000,
                        maxSctpMessageSize: 262144,
                },

图片描述
总体配置

/**
 * IMPORTANT (PLEASE READ THIS):
 *
 * This is not the "configuration file" of mediasoup. This is the configuration
 * file of the mediasoup-demo server. mediasoup is a server-side library, it
 * does not read any "configuration file". Instead it exposes an API. This demo
 * application just reads settings from this file (once copied to config.mjs)
 * and calls the mediasoup API with those settings when appropriate.
 */

import * as os from 'node:os';

/**
 * @type {import('./src/types.ts').ServerConfig}
 */
export const config = {
        /**
         * Server domain. WebSocket and HTTP API connections with an Origin header
         * not matching this domain will be rejected.
         */
        domain: 'localhost',
        /**
         * Signaling settings (Protoo WebSocket server and HTTP API server).
         */
        http: {
                listenIp: '0.0.0.0',
                listenPort: Number(process.env['HTTP_LISTEN_PORT'] ?? 4443),
                /**
                 * Optional. If tls is not set, server will use HTTP instead.
                 */
                tls: {
                        cert: '/home/xiyan/reserver/mediasoup-demo/server/certs/cert.pem',
                        key: '/home/xiyan/reserver/mediasoup-demo/server/certs/key.pem'
                },
        },
        /**
         * mediasoup settings.
         */
        mediasoup: {
                // Number of mediasoup workers to launch.
                numWorkers: Object.keys(os.cpus()).length,
                /**
                 * mediasoup WorkerSettings.
                 *
                 * @see https://mediasoup.org/documentation/v3/mediasoup/api/#WorkerSettings
                 */
                workerSettings: {
                        dtlsCertificateFile: undefined,
                        dtlsPrivateKeyFile: undefined,
                        logLevel: 'warn',
                        logTags: [
                                'info',
                                'ice',
                                'dtls',
                                'rtp',
                                'srtp',
                                'rtcp',
                                'rtx',
                                'bwe',
                                'score',
                                'simulcast',
                                'svc',
                                'sctp',
                        ],
                        disableLiburing: false,
                },
                /**
                 * mediasoup Router options.
                 *
                 * @see https://mediasoup.org/documentation/v3/mediasoup/api/#RouterOptions
                 */
                routerOptions: {
                        mediaCodecs: [
                                {
                                        kind: 'audio',
                                        mimeType: 'audio/opus',
                                        clockRate: 48000,
                                        channels: 2,
                                },
                                {
                                        kind: 'video',
                                        mimeType: 'video/VP8',
                                        clockRate: 90000,
                                        parameters: {
                                                'x-google-start-bitrate': 1000,
                                        },
                                },
                                {
                                        kind: 'video',
                                        mimeType: 'video/VP9',
                                        clockRate: 90000,
                                        parameters: {
                                                'profile-id': 2,
                                                'x-google-start-bitrate': 1000,
                                        },
                                },
                                {
                                        kind: 'video',
                                        mimeType: 'video/h264',
                                        clockRate: 90000,
                                        parameters: {
                                                'packetization-mode': 1,
                                                'profile-level-id': '4d0032',
                                                'level-asymmetry-allowed': 1,
                                                'x-google-start-bitrate': 1000,
                                        },
                                },
                                {
                                        kind: 'video',
                                        mimeType: 'video/h264',
                                        clockRate: 90000,
                                        parameters: {
                                                'packetization-mode': 1,
                                                'profile-level-id': '42e01f',
                                                'level-asymmetry-allowed': 1,
                                                'x-google-start-bitrate': 1000,
                                        },
                                },
                        ],
                },
                /**
                 * mediasoup WebRtcServer options for WebRTC endpoints (mediasoup-client,
                 * libmediasoupclient).
                 *
                 * @see https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcServerOptions
                 *
                 * @remarks
                 * - `port` is mandatory here.
                 * - Room.ts in mediasoup-demo server will increase this port for each
                 *   mediasoup Worker since each Worker is a separate process.
                 */
                webRtcServerOptions: {
                        listenInfos: [
                                {
                                        protocol: 'udp',
                                        ip: process.env['MEDIASOUP_LISTEN_IP'] ?? '0.0.0.0',
                                        announcedAddress: process.env['MEDIASOUP_ANNOUNCED_ADDRESS'],
                                        port: 44444,
                                        sendBufferSize: undefined,
                                        recvBufferSize: undefined,
                                },
                                {
                                        protocol: 'tcp',
                                        ip: process.env['MEDIASOUP_LISTEN_IP'] ?? '0.0.0.0',
                                        announcedAddress: process.env['MEDIASOUP_ANNOUNCED_ADDRESS'],
                                        port: 44444,
                                        sendBufferSize: undefined,
                                        recvBufferSize: undefined,
                                },
                        ],
                },
                /**
                 * mediasoup WebRtcTransport options for WebRTC endpoints (mediasoup-client,
                 * libmediasoupclient).
                 *
                 * @see https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions
                 */
                webRtcTransportOptions: {
                        listenIps : [
                                {ip : '0.0.0.0',announcedIp:null}
                        ],

                        initialAvailableOutgoingBitrate: 1000000,
                        minimumAvailableOutgoingBitrate: 600000,
                        maxSctpMessageSize: 262144,
                },
                /**
                 * Additional options that are not part of WebRtcTransportOptions but
                 * instead used for function calls.
                 */
                additionalWebRtcTransportOptions: {
                        maxIncomingBitrate: undefined,
                },
                /**
                 * mediasoup PlainTransport options for RTP endpoints (FFmpeg, GStreamer).
                 *
                 * @see https://mediasoup.org/documentation/v3/mediasoup/api/#PlainTransportOptions
                 */
                plainTransportOptions: {
                        listenInfo: {
                                protocol: 'udp',
                                ip: process.env['MEDIASOUP_LISTEN_IP'] ?? '0.0.0.0',
                                announcedAddress: process.env['MEDIASOUP_ANNOUNCED_ADDRESS'],
                                portRange: {
                                        min: Number(process.env['MEDIASOUP_MIN_PORT'] ?? 40000),
                                        max: Number(process.env['MEDIASOUP_MAX_PORT'] ?? 40999),
                                },
                                // sendBufferSize: 2000000,
                                // recvBufferSize: 2000000,
                        },
                        maxSctpMessageSize: 262144,
                },
        },
};

正在回答 回答被采纳积分+3

1回答

李超 4天前

你的虚拟机访问摄像头了吗?看看虚拟机本身是否可以打开摄像头

0 回复 有任何疑惑可以回复我~
  • 提问者 JY8788487 #1
    我查看/dev下没有看到video0,video1这样的关键字。摄像头应该是没有打开的。
    回复 有任何疑惑可以回复我~ 4天前
  • 李超 回复 提问者 JY8788487 #2
    那肯定没视频呀,是不是你装的linux 系统是服务版?服务版都没有视频模块,PC版才有
    回复 有任何疑惑可以回复我~ 4天前
  • 提问者 JY8788487 回复 李超 #3
    我安装的是wsl,不是使用vmware虚拟机的方式装的,应该是服务版。
    回复 有任何疑惑可以回复我~ 4天前
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号