Mediasoup 客户端设备无法使用正确的 rtp 功能正确加载视频功能

问题描述 投票:0回答:1

我正在尝试使用从服务器收到的 rtpCapability 加载 mediasoup 客户端设备,以便在我的网站上创建视频流。但是,我正在创建的设备不断返回一个对象:_canProduceByKind: {audio: false, video: false},因此每当我尝试创建我的制作者传输时,它都会显示“UnsupportedError:无法生成视频”。

这是控制台记录时返回的完整设备对象:

{
    "_loaded": true,
    "_observer": {
        "_events": {},
        "_eventsCount": 0,
        "_maxListeners": null
    },
    "_handlerName": "Chrome111",
    "_extendedRtpCapabilities": {
        "codecs": [],
        "headerExtensions": []
    },
    "_recvRtpCapabilities": {
        "codecs": [],
        "headerExtensions": []
    },
    "_canProduceByKind": {
        "audio": false,
        "video": false
    },
    "_sctpCapabilities": {
        "numStreams": {
            "OS": 1024,
            "MIS": 1024
        }
    }
}

这是在加载中传递的 rtpCababilites:

{
    "rtpCapabilities": {
        "codecs": [
            {
                "kind": "audio",
                "mimeType": "audio/opus",
                "clockRate": 48000,
                "channels": 2,
                "rtcpFeedback": [
                    {
                        "type": "nack",
                        "parameter": ""
                    },
                    {
                        "type": "transport-cc",
                        "parameter": ""
                    }
                ],
                "parameters": {},
                "preferredPayloadType": 100
            },
            {
                "kind": "video",
                "mimeType": "video/VP8",
                "clockRate": 90000,
                "rtcpFeedback": [
                    {
                        "type": "nack",
                        "parameter": ""
                    },
                    {
                        "type": "nack",
                        "parameter": "pli"
                    },
                    {
                        "type": "ccm",
                        "parameter": "fir"
                    },
                    {
                        "type": "goog-remb",
                        "parameter": ""
                    },
                    {
                        "type": "transport-cc",
                        "parameter": ""
                    }
                ],
                "parameters": {
                    "x-google-start-bitrate": 1000
                },
                "preferredPayloadType": 101
            },
            {
                "kind": "video",
                "mimeType": "video/rtx",
                "preferredPayloadType": 102,
                "clockRate": 90000,
                "parameters": {
                    "apt": 101
                },
                "rtcpFeedback": []
            }
        ],
        "headerExtensions": [
           {All the video headers.... alot of them}
        ]
    }
}

这是我初始化设备的方法:

    const createDevice = async () => {
        try{

            console.log(mediasoupClient)
            console.log('RtpCapabilities', rtpCapabilities)

            deviceRef.current  = new mediasoupClient.Device()
                await deviceRef.current.load({
                    routerRtpCapabilities: rtpCapabilities
                })

        }
        catch(err){
            console.log(err)
            if(err.name === 'UnsupportedError'){
                console.warn('browser not supported')
            }
        }
    }

我在初始化之前检查了 rtp 功能,并且确实将它们发送到正确加载。

我检查了我的 mediasoup 客户端并返回版本:“3.7.14”,

如果有人能帮助我解决这个头痛问题,那就太棒了!谢谢!!

reactjs node.js video-streaming mediasoup
1个回答
0
投票

我发送了一个带有 rtpCapability 对象的对象,而不是 rtpCapability 对象本身,现在我正把脸埋在键盘上,因为我浪费了 3 个小时检查文档。编程很有趣!!

© www.soinside.com 2019 - 2024. All rights reserved.