Hello, i am trying to feed the device with the output of server side outer.rtpCapabilities and getting the below error any idea?
import { Device } from “mediasoup-client”;
const routerRtpCapabilities = {
“codecs”:[
],
“headerExtensions”:[
{
“kind”:“audio”,
“uri”:“urn:ietf:params:rtp-hdrext:sdes:mid”,
“preferredId”:1,
“preferredEncrypt”:false,
“direction”:“sendrecv”
},
{
“kind”:“video”,
“uri”:“urn:ietf:params:rtp-hdrext:sdes:mid”,
“preferredId”:1,
“preferredEncrypt”:false,
“direction”:“sendrecv”
},
{
“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”:“recvonly”
},
{
“kind”:“video”,
“uri”:“http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01”,
“preferredId”:5,
“preferredEncrypt”:false,
“direction”:“sendrecv”
},
{
“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”
}
]
}
async function alertME() {
const device = new Device();
console.log(device);
console.log('done');
await device.load( { routerRtpCapabilities } );
if (!device.canProduce('video')) {
console.warn('cannot produce video');
}
// Abort next steps.
}
alertME();
tsc client.ts
client.ts:113:25 - error TS2322: Type ‘{ codecs: any[]; headerExtensions: { kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]; }’ is not assignable to type ‘RtpCapabilities’.
Types of property ‘headerExtensions’ are incompatible.
Type ‘{ kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]’ is not assignable to type ‘RtpHeaderExtension[]’.
Type ‘{ kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }’ is not assignable to type ‘RtpHeaderExtension’.
Types of property ‘kind’ are incompatible.
Type ‘string’ is not assignable to type ‘"" | “audio” | “video”’.
113 await device.load( { routerRtpCapabilities } );
~~~~~~~~~~~~~~~~~~~~~
node_modules/mediasoup-client/lib/Device.d.ts:68:9
68 routerRtpCapabilities: RtpCapabilities;
~~~~~~~~~~~~~~~~~~~~~
The expected type comes from property ‘routerRtpCapabilities’ which is declared here on type ‘{ routerRtpCapabilities: RtpCapabilities; }’
Found 1 error.
tsc client.ts
client.ts:113:25 - error TS2322: Type ‘{ codecs: any[]; headerExtensions: { kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]; }’ is not assignable to type ‘RtpCapabilities’.
Types of property ‘headerExtensions’ are incompatible.
Type ‘{ kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]’ is not assignable to type ‘RtpHeaderExtension[]’.
Type ‘{ kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }’ is not assignable to type ‘RtpHeaderExtension’.
Types of property ‘kind’ are incompatible.
Type ‘string’ is not assignable to type ‘"" | “audio” | “video”’.
113 await device.load( { routerRtpCapabilities } );
~~~~~~~~~~~~~~~~~~~~~
node_modules/mediasoup-client/lib/Device.d.ts:68:9
68 routerRtpCapabilities: RtpCapabilities;
~~~~~~~~~~~~~~~~~~~~~
The expected type comes from property ‘routerRtpCapabilities’ which is declared here on type ‘{ routerRtpCapabilities: RtpCapabilities; }’
Found 1 error.
tsc client.ts
client.ts:113:24 - error TS2345: Argument of type ‘{ codecs: any[]; headerExtensions: { kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]; }’ is not assignable to parameter of type ‘{ routerRtpCapabilities: RtpCapabilities; }’.
Property ‘routerRtpCapabilities’ is missing in type ‘{ codecs: any[]; headerExtensions: { kind: string; uri: string; preferredId: number; preferredEncrypt: boolean; direction: string; }[]; }’ but required in type ‘{ routerRtpCapabilities: RtpCapabilities; }’.
113 await device.load( routerRtpCapabilities );
~~~~~~~~~~~~~~~~~~~~~
node_modules/mediasoup-client/lib/Device.d.ts:68:9
68 routerRtpCapabilities: RtpCapabilities;
~~~~~~~~~~~~~~~~~~~~~
‘routerRtpCapabilities’ is declared here.
Found 1 error.