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
| Event | Description |
|---|---|
state | Connection state |
streamstart | Publishing started |
streamstop | Publishing stopped |
sourcechange | Input source changed |
permissiondenied | Permission denied |
error | Error |
iceconnectionstate | ICE connection state |
See Publishing Guide and PublisherOptions.