mediasoup 3.15.0 released with TypeScript interfaces

mediasoup node 3.15.0 has been released. It comes with important additions all them made in this PR 1463:

  • mediasoup.types namespace no longer exports real JavaScript classes but now it exports TypeScript interfaces.
  • For example, mediasoup.types.Producer is no longer a class. Now it’s a TypeScript interface and the parent application can use it to mock mediasoup classes for testing purposes, etc.
  • Added new transport.type getter than returns 'webrtc' | 'plain' | 'pipe' | 'direct'.
  • Added new rtpObserver.type getter than returns 'activespeaker' | 'audiolevel'.

Other than the 2 last additions above, nothing has changed at public API level. However, if your application uses instanceof you need to migrate it as follows:

Previously

if (transport instanceof mediasoupTypes.PlainTransport) {
  // This is a PlainTransport.
}

Now

if (transport.type === 'plain') {
  // This is a PlainTransport.
}
3 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.