Skip to content

RtcPublisher

Pushes local media streams to streaming servers.

Constructor

typescript
new RtcPublisher(options: RtcPublisherOptions)

Methods

start() async

Start publishing.

typescript
await publisher.start();

stop()

Stop publishing.

typescript
publisher.stop();

switchSource(source) async

Switch input source without rebuilding connection.

typescript
await publisher.switchSource({ type: 'screen', audio: true });

getStream()

Get local MediaStream.

typescript
const stream = publisher.getStream();

destroy()

Destroy instance and release resources.

typescript
publisher.destroy();

Events

EventDescription
stateConnection state
streamstartPublishing started
streamstopPublishing stopped
sourcechangeInput source changed
permissiondeniedPermission denied
errorError
iceconnectionstateICE connection state

See Publishing Guide and PublisherOptions.

基于 MIT 许可证发布