setRtpEncodingParameters() documentation/implementation/typings issue
See original GitHub issueThere is currently a problem with producer.setRtpEncodingParameters()
method:
- Both actual implementation in browser handlers and documentation expect
RTCRtpEncodingParameters
as an argument - Producer’s API has TypeScript type defined as
RTCRtpEncodingParameters[]
instead (I guess it only compiles because there is a type information erasing in handlers withparams: any
)
https://github.com/versatica/mediasoup-client/blob/3aa7f7c3eca4ef39f5e8b3cdb448dbe5008cc71c/src/Producer.ts#L396-L398 https://github.com/versatica/mediasoup-client/blob/3aa7f7c3eca4ef39f5e8b3cdb448dbe5008cc71c/src/handlers/Chrome74.ts#L520-L541
So in TypeScript project it is possible to either specify something that is RTCRtpEncodingParameters[]
and will not work or you have to cast it to any
to be able to use RTCRtpEncodingParameters
directly.
The more annoying thing is that RTCRtpEncodingParameters
alone, which is the de-facto current implementation, doesn’t allow applying different values to different encodings (simulcast).
I’d suggest is to add support for RTCRtpEncodingParameters[]
such that it is possible to have different parameters for different encodings, but until next major version bump also support old plain RTCRtpEncodingParameters
argument for those who rely on it.
If that sounds good, I can prepare a PR.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
This method should just be removed, you can already get get the RtpSender. No need for sugar APIs. But it’s too late to remove it.
BTW you can not change the number of encodings in runtime.
Fixed in 3.6.12.