Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/modules/StreamingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export class StreamingClient {
case SignalMessageAction.WARNING:
const message = signalMessage.payload as string;
console.warn('Warning received from server: ' + message);
this.publicEventEmitter.emit(AnamEvent.SERVER_WARNING, message);
break;
case SignalMessageAction.TALK_STREAM_INTERRUPTED:
const chatMessage =
Expand All @@ -282,9 +283,13 @@ export class StreamingClient {
chatMessage.correlationId,
);
break;
case SignalMessageAction.SESSION_READY:
const sessionId = signalMessage.sessionId as string;
this.publicEventEmitter.emit(AnamEvent.SESSION_READY, sessionId);
break;
default:
console.error(
'StreamingClient - onSignalMessage: unknown signal message action type',
'StreamingClient - onSignalMessage: unknown signal message action type. Is your anam-sdk version up to date?',
signalMessage,
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/types/events/public/AnamEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export enum AnamEvent {
VIDEO_PLAY_STARTED = 'VIDEO_PLAY_STARTED',
AUDIO_STREAM_STARTED = 'AUDIO_STREAM_STARTED',
TALK_STREAM_INTERRUPTED = 'TALK_STREAM_INTERRUPTED',
SESSION_READY = 'SESSION_READY',
SERVER_WARNING = 'SERVER_WARNING',
}
2 changes: 2 additions & 0 deletions src/types/events/public/EventCallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export type EventCallbacks = {
[AnamEvent.VIDEO_PLAY_STARTED]: () => void;
[AnamEvent.AUDIO_STREAM_STARTED]: (audioStream: MediaStream) => void;
[AnamEvent.TALK_STREAM_INTERRUPTED]: (correlationId: string) => void;
[AnamEvent.SESSION_READY]: (sessionId: string) => void;
[AnamEvent.SERVER_WARNING]: (message: string) => void;
};
1 change: 1 addition & 0 deletions src/types/signalling/SignalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum SignalMessageAction {
WARNING = 'warning',
TALK_STREAM_INTERRUPTED = 'talkinputstreaminterrupted',
TALK_STREAM_INPUT = 'talkstream',
SESSION_READY = 'sessionready',
}

export interface SignalMessage {
Expand Down