AbstractId of the owning peer.
The underlying mediasoup producer/consumer handle to wrap.
Protected Readonly_The wrapped mediasoup producer/consumer handle.
ReadonlypeerId of the peer this entity belongs to.
Abstract ReadonlyroleWhether this entity produces or consumes media.
Whether the entity has been closed.
The underlying entity's id.
The media kind ("audio" or "video").
Whether the entity is currently paused.
Closes the entity and releases its resources. Idempotent: safe to call multiple times, and MediaEntityEvent.Closed is emitted only once.
Synchronously invokes every listener registered for event, in registration order.
true if at least one listener was invoked, false if there were none.
The listener list is snapshotted before dispatch, so mutations made by handlers take effect only on subsequent emissions. Listeners are isolated: if one throws, the remaining listeners still run and the error is surfaced via console.error rather than swallowed silently (consistent with LocalMessageBus).
Returns the number of listeners currently registered for event.
The event name to count listeners for.
The count of registered listeners (0 if none).
Registers a listener that is invoked at most once: it is removed automatically before
being called the first time event is emitted.
This emitter, for chaining.
Remove a pending one-time listener by passing the same function reference to off.
Pauses the entity. No-op if already closed or paused.
Emits MediaEntityEvent.Paused when a pause actually occurs.
Removes listeners for a single event, or for all events.
Optionalevent: keyof MediaEntityEventsThe event name to clear; if omitted, listeners for every event are removed.
This emitter, for chaining.
Resumes the entity. No-op if closed or not paused.
Emits MediaEntityEvent.Resumed when a resume actually occurs.
Server-side (mediasoup SFU) base class shared by Producer and Consumer. Wraps a mediasoup entity, forwards its
transportcloseto a MediaEntityEvent.Closed event (emitted at most once), and guards pause/ resume/close so they are idempotent.