Participant Class Events - Flutter
streamEnabled,streamDisabled,streamPaused,streamResumedandonE2EEStateChangedare delivered on the participant, for its own streams, and on theRoom, for every participant. On the room,stream.participantIdtells you whose stream it is.- An AI agent in the room is an
AgentParticipant, and itsisAgent()returnstrue. It delivers its own events, which you listen for withon()on the agent.
streamEnabled
- This event will be emitted on the participant, and on the
Room, when the participant starts sending or receiving a stream of any type. - The stream is also added to that participant's
streams.
Example
participant.on(Events.streamEnabled, (RTCStream stream) {
if (stream.kind == MediaType.VIDEO) {
// do something
}
});
// Or, for every participant, on the room:
room.on(Events.streamEnabled, (RTCStream stream) {
if (stream.participantId == participant.id) {
// do something
}
});
streamDisabled
- This event will be emitted on the participant, and on the
Room, when the participant stops sending or receiving a stream of any type. - The stream is also removed from that participant's
streams.
Example
participant.on(Events.streamDisabled, (RTCStream stream) {
// do something
});
streamPaused
- This event will be emitted on the participant, and on the
Room, when a stream you receive from this participant is paused. - The handler receives the stream's
kind(audio,videoorshare) and thereason.
Example
participant.on(Events.streamPaused, (String? kind, String? reason) {
// do something
});
streamResumed
- This event will be emitted on the participant, and on the
Room, when a paused stream you receive from this participant is resumed. - The handler receives the stream's
kind(audio,videoorshare) and thereason.
Example
participant.on(Events.streamResumed, (String? kind, String? reason) {
// do something
});
onE2EEStateChanged
- This event will be emitted on the participant, and on the
Room, when the end-to-end encryption state of one of its streams changes. - It reports
EncryptionSuccessorDecryptionSuccesswhen encryption of that stream starts. Decryption failures are not reported yet. - The handler receives the new
E2EEStateand theRTCStreamit applies to. The stream isnullwhen the participant no longer has it.
Example
participant.on(Events.onE2EEStateChanged, (E2EEState state, RTCStream? stream) {
if (state == E2EEState.DecryptionSuccess) {
// show that this participant's media is encrypted end to end
}
});
agentStateChanged
- This event will be emitted on an
AgentParticipantwhen the agent's state changes. - The handler receives the new
AgentState:IDLE,LISTENING,THINKINGorSPEAKING.
Example
room.on(Events.participantJoined, (Participant participant) {
if (participant is AgentParticipant) {
participant.on(Events.agentStateChanged, (AgentState state) {
// do something
});
}
});
agentTranscriptionReceived
- This event will be emitted on an
AgentParticipantwhen the agent sends a transcription segment. - The handler receives a
TranscriptionSegment, with thetextand itstimestampin milliseconds, and theParticipantwho spoke.
Example
agent.on(Events.agentTranscriptionReceived,
(TranscriptionSegment segment, Participant participant) {
// do something with segment.text
});
agentMetrics
- This event will be emitted on an
AgentParticipantwhen the agent sends metrics. - The handler receives the metrics as a
Map<String, dynamic>.
Example
agent.on(Events.agentMetrics, (Map<String, dynamic> metrics) {
// do something
});
Got a Question? Ask us on discord

