Skip to content

Commit 430b02f

Browse files
authored
Update documentation for StreamingTranscriber usage
Replaced old RealtimeTranscriber with StreamingTranscriber
1 parent a26f7da commit 430b02f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/compat.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ If you do use an older version of Node.js like version 16, you'll need to polyfi
1313
To make the SDK compatible with the browser, the SDK aims to use web standards as much as possible.
1414
However, there are still incompatibilities between Node.js and the browser.
1515

16-
- `RealtimeTranscriber` doesn't support the AssemblyAI API key in the browser.
17-
Instead, you have to generate a temporary auth token using `client.realtime.createTemporaryToken`, and pass in the resulting token to the real-time transcriber.
16+
- `StreamingTranscriber` doesn't support the AssemblyAI API key in the browser.
17+
Instead, you have to generate a temporary auth token using `client.streaming.createTemporaryToken`, and pass in the resulting token to the streaming transcriber.
1818

1919
Generate a temporary auth token on the server.
2020

@@ -23,24 +23,24 @@ However, there are still incompatibilities between Node.js and the browser.
2323
// Ideally, to avoid embedding your API key client side,
2424
// you generate this token on the server, and pass it to the client via an API.
2525
const client = new AssemblyAI({ apiKey: "YOUR_API_KEY" });
26-
const token = await client.realtime.createTemporaryToken({ expires_in = 480 });
26+
const token = await client.streaming.createTemporaryToken({ expires_in_seconds: 60 });
2727
```
2828

2929
> [!NOTE]
3030
> We recommend generating the token on the server, so you don't embed your AssemblyAI API key in your client app.
3131
> If you embed the API key on the client, everyone can see it and use it for themselves.
3232
3333
Then pass the token via an API to the client.
34-
On the client, create an instance of `RealtimeTranscriber` using the token.
34+
On the client, create an instance of `StreamingTranscriber` using the token.
3535

3636
```js
37-
import { RealtimeTranscriber } from "assemblyai";
37+
import { StreamingTranscriber } from "assemblyai";
3838
// or the following if you're using UMD
39-
// const { RealtimeTranscriber } = assemblyai;
39+
// const { StreamingTranscriber } = assemblyai;
4040

4141
const token = getToken(); // getToken is a function for you to implement
4242

43-
const rt = new RealtimeTranscriber({
43+
const rt = new StreamingTranscriber({
4444
token: token,
4545
});
4646
```

0 commit comments

Comments
 (0)