Remote Mediasoup client mock
Remote Mediasoup client mock
This project host a class with the same API of the
Remote Mediasoup client. It’s
intended to be used for both testing purposes and as a testbed for the migration
of projects currently based on Mediasoup to use the
Remote Mediasoup client instead. Behavior is mostly the same that the one
offered by the Remote Mediasoup client instances, being the only two
differences:
-
Remote Mediasoup client mockuses a local instance ofMediasoupinstead of connecting to an instance of Remote Mediasoup server - due to that,
ConnectionWebSocket events are emulated instead of being real ones
Install
npm install --save-dev @mafalda-sfu/remote-mediasoup-client-mock
API
See API documentation.
Usage
If you already have a Mediasoup based project, to use
Remote Mediasoup client mock on it you’ll only need to do two changes in
your project code:
-
Replace the
mediasoupimport for@mafalda-sfu/remote-mediasoup-client-mock:- import mediasoup from 'mediasoup' + import RemoteMediasoupClientMock from '@mafalda-sfu/remote-mediasoup-client-mock' -
Create the instance of the
RemoteMediasoupClientMockobject, wait for itsconnectedevent, and access to themediasoupproperty:+ const remoteMediasoupClientMock = new RemoteMediasoupClientMock + + await once(remoteMediasoupClientMock, 'connected') + + const {mediasoup} = remoteMediasoupClientMock
After that, the mediasoup variable will have an object that’s API compatible
with the Mediasoup API
provided by the Mediasoup package.