Improving the logs and updating status
This commit is contained in:
@@ -71,7 +71,7 @@ class ChatbotClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleEventToConsole (evt) {
|
handleEventToConsole (evt) {
|
||||||
console.log("Received event: ", evt);
|
this.log(`Received event: ${evt.action}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,18 +81,28 @@ class ChatbotClient {
|
|||||||
setupTrackListeners() {
|
setupTrackListeners() {
|
||||||
if (!this.dailyCallObject) return;
|
if (!this.dailyCallObject) return;
|
||||||
|
|
||||||
this.dailyCallObject.on("joined-meeting", this.handleEventToConsole);
|
this.dailyCallObject.on("joined-meeting", () => {
|
||||||
|
this.updateStatus('Connected');
|
||||||
|
this.connectBtn.disabled = true;
|
||||||
|
this.disconnectBtn.disabled = false;
|
||||||
|
this.log('Client connected');
|
||||||
|
});
|
||||||
this.dailyCallObject.on("track-started", (evt) => {
|
this.dailyCallObject.on("track-started", (evt) => {
|
||||||
if (evt.track.kind === "audio" && evt.participant.local === false) {
|
if (evt.track.kind === "audio" && evt.participant.local === false) {
|
||||||
this.setupAudioTrack(evt.track);
|
this.setupAudioTrack(evt.track);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.dailyCallObject.on("track-stopped", this.handleEventToConsole);
|
this.dailyCallObject.on("track-stopped", this.handleEventToConsole.bind(this));
|
||||||
this.dailyCallObject.on("participant-joined", this.handleEventToConsole);
|
this.dailyCallObject.on("participant-joined", this.handleEventToConsole.bind(this));
|
||||||
this.dailyCallObject.on("participant-updated", this.handleEventToConsole);
|
this.dailyCallObject.on("participant-updated", this.handleEventToConsole.bind(this));
|
||||||
this.dailyCallObject.on("participant-left", this.handleEventToConsole);
|
this.dailyCallObject.on("participant-left", this.handleEventToConsole.bind(this));
|
||||||
this.dailyCallObject.on("left-meeting", this.handleEventToConsole);
|
this.dailyCallObject.on("left-meeting", () => {
|
||||||
this.dailyCallObject.on("error", this.handleEventToConsole);
|
this.updateStatus('Disconnected');
|
||||||
|
this.connectBtn.disabled = false;
|
||||||
|
this.disconnectBtn.disabled = true;
|
||||||
|
this.log('Client disconnected');
|
||||||
|
});
|
||||||
|
this.dailyCallObject.on("error", this.handleEventToConsole.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user