Event triggered when a new publisher starts publishing to the stream.
import { Publisher, Room } from '@millicast/sdk-interactivity';
const room = new Room({
streamName,
streamAccountId,
publisherName,
});
room.on('publisherJoined', (publisher: Publisher) => {
console.log(`The publisher ${publisher.name} has joined the stream.`);
// TODO: Add the video element to the UI
});
Event triggered when a new source is being published to the stream.
import { Publisher, Room, Source } from '@millicast/sdk-interactivity';
const room = new Room({
streamName,
streamAccountId,
publisherName,
});
room.on('sourceAdded', async (publisher: Publisher, source: Source) => {
console.log(`The publisher ${publisher.name} has started publishing the source ${source.sourceId.sourceName} (${source.sourceId.sourceType}).`);
// Request to receive the source
await source.receive();
// TODO: Add the media stream to the UI
const stream = source.mediaStream;
});
Event triggered when a source stopped being published.
The Publisher object that represents the publisher who stopped publishing the source.
The SourceIdentifier object that the represent the identifier of the source that stopped being published.
Events triggered by the Room object.