Skip to content

Commit 2e8f70e

Browse files
authored
Use Fishjam URL in the transcription demo (#191)
## Description Allows to use FISHJAM_URL in the transcription demo
1 parent c23d81f commit 2e8f70e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

examples/transcription/src/environment.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ declare global {
22
namespace NodeJS {
33
interface ProcessEnv {
44
FISHJAM_ID?: string;
5+
FISHJAM_URL?: string;
56
FISHJAM_TOKEN?: string;
67
GEMINI_API_KEY?: string;
78
}

examples/transcription/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import { peerController } from './controllers/peers';
33
import { FishjamService } from './service/fishjam';
44
import { TranscriptionService } from './service/transcription';
55

6-
if (!process.env.FISHJAM_ID || !process.env.FISHJAM_TOKEN || !process.env.GEMINI_API_KEY) {
6+
if (!(process.env.FISHJAM_ID || process.env.FISHJAM_URL) || !process.env.FISHJAM_TOKEN || !process.env.GEMINI_API_KEY) {
77
throw Error('Environment variables FISHJAM_ID, FISHJAM_TOKEN and GEMINI_API_KEY are required.');
88
}
99

1010
const fishjamConfig = {
11-
fishjamUrl: 'http://localhost:5002',
11+
fishjamUrl: process.env.FISHJAM_URL,
1212
fishjamId: process.env.FISHJAM_ID,
1313
managementToken: process.env.FISHJAM_TOKEN,
1414
};
15+
1516
const fishjam = new FishjamService(fishjamConfig);
1617

1718
new TranscriptionService(fishjamConfig, process.env.GEMINI_API_KEY);

examples/transcription/src/service/transcription.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ export class TranscriptionService {
8787
}
8888

8989
async handleAgentDisconnected(message: PeerDisconnected) {
90-
console.log(`Agent ${message.peerId} disconnected, removing room`);
90+
console.log(`Agent ${message.peerId} disconnected`);
9191

92-
await this.fishjamClient.deleteRoom(message.roomId);
9392
this.agents.delete(message.roomId);
9493
}
9594

0 commit comments

Comments
 (0)