mediasfu-shared
This page targets mediasfu-shared@1.3.3. A restricted, revocable credential
may be used for isolated local development and must never be committed. Before
sharing or releasing the client, move reusable Cloud credentials behind the
secure backend guide.
mediasfu-shared is MediaSFU's low-level TypeScript room core. It gives an app
the room, socket, transport, permission, media, participant, screen-sharing,
and exit primitives; it does not render a room, participant tile, or control
bar for you.
Use it when your team owns the complete interface and runtime orchestration. For a prebuilt room, choose a platform SDK instead.
Copy/paste starter
Install the shared core and its peer dependencies:
npm install mediasfu-shared@1.3.3 mediasoup-client socket.io-client
Create a small operation binding for the controls your app will render:
import {
allMembers,
checkPermission,
clickAudio,
clickScreenShare,
clickVideo,
confirmExit,
processConsumerTransports,
} from 'mediasfu-shared';
export const roomCore = {
receiveMembers: allMembers,
checkPermission,
toggleMicrophone: clickAudio,
toggleCamera: clickVideo,
receiveRemoteMedia: processConsumerTransports,
toggleScreenShare: clickScreenShare,
leaveParticipant: confirmExit,
};
This object does not create a room or render controls. Continue with the shared-core room operations guide to connect it to app-owned UI, runtime parameters, recovery states, and cleanup.
Before you start
- Install
mediasfu-shared1.3.3 with compatiblemediasoup-clientandsocket.io-clientpeer dependencies, and lock them in your package manager. - Provide an authenticated application backend for room authority. Never place reusable MediaSFU credentials in a browser, mobile bundle, desktop app, or source repository.
- Plan your own interface for the room, participants, media controls, errors, and cleanup. The shared core supplies no rendered UI.
The shared-core room operations guide shows a safe application boundary and the exact primitives to bind for joining, member updates, permission decisions, media, screen sharing, and participant exit.
Room creation belongs on your backend; the shared core has no safe client-side
create call. To end the room as host, call confirmExit or leaveRoom with
endRoomOnHostExit: true (the default); pass false to let a host leave
without ending the room. See Leave, end, and rejoin.