Error with RTP Caps

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.

Are you telling typescript compiler that what you are getting form the server is an object of type RtpCapabilities? This is, are you indicating the type of what you are retrieving from the server?

Thanks for this i did include it but for some reason i still cant produce video. I got a usb cam plugged to my computer and using chrome/firefox under linux seems not to detect that.

I am using self signed nginx certs, and using the website getUserMedia works fine in detecting the webcam but not mediasoup client

output of device:

  1. Device {_loaded: false, _observer: EnhancedEventEmitter, _handlerName: “Chrome74”, _extendedRtpCapabilities: undefined, _handlerFactory: ƒ, …}

1. _canProduceByKind: {audio: false, video: false}
2. _extendedRtpCapabilities: {codecs: Array(0), headerExtensions: Array(11)}
3. _handlerFactory: () => new Chrome74()
4. _handlerName: “Chrome74”
5. _loaded: true
6. _observer: EnhancedEventEmitter {_events: {…}, _eventsCount: 0, _maxListeners: Infinity}
7. _recvRtpCapabilities: {codecs: Array(0), headerExtensions: Array(8)}
8. _sctpCapabilities: {numStreams: {…}}
9. handlerName: (…)
10. loaded: (…)
11. observer: (…)
12. rtpCapabilities: (…)
13. sctpCapabilities: (…)
14. proto: Object

How is this related to the TypeScript issue topic?

i will open a new thread