@ephia/transcribe-sdk 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,26 @@ npm install @ephia/transcribe-sdk
|
|
|
11
11
|
## Prérequis
|
|
12
12
|
|
|
13
13
|
- Contexte sécurisé (HTTPS ou localhost) pour l’accès au microphone.
|
|
14
|
-
-
|
|
14
|
+
- Importer les styles du SDK (obligatoire) : `@ephia/transcribe-sdk/dist/styles.css`
|
|
15
|
+
- Fichier **audio-processor.js** (obligatoire) : le SDK charge par défaut `/audio-processor.js`. Vous devez donc servir ce fichier depuis vos assets statiques.
|
|
16
|
+
|
|
17
|
+
### Installer le worklet `audio-processor.js`
|
|
18
|
+
|
|
19
|
+
Après `npm install`, copiez le worklet depuis `node_modules` vers vos assets statiques.
|
|
20
|
+
|
|
21
|
+
- Vite / CRA / tout projet avec dossier `public/` :
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cp node_modules/@ephia/transcribe-sdk/dist/audio-processor.js public/audio-processor.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Next.js :
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cp node_modules/@ephia/transcribe-sdk/dist/audio-processor.js public/audio-processor.js
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Si vous ne pouvez pas copier de fichier, vous pouvez aussi héberger ce worklet ailleurs et passer `audioProcessorUrl`.
|
|
15
34
|
|
|
16
35
|
## Utilisation
|
|
17
36
|
|
|
@@ -38,6 +57,14 @@ function TranscriptDisplay() {
|
|
|
38
57
|
}
|
|
39
58
|
```
|
|
40
59
|
|
|
60
|
+
### Next.js (App Router)
|
|
61
|
+
|
|
62
|
+
Le bouton utilise le micro, donc il doit être rendu côté client. Dans Next.js, placez-le dans un composant avec :
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
"use client";
|
|
66
|
+
```
|
|
67
|
+
|
|
41
68
|
## Props principales
|
|
42
69
|
|
|
43
70
|
- **token** (requis) : clé API Ephia.
|
|
@@ -45,6 +72,22 @@ function TranscriptDisplay() {
|
|
|
45
72
|
- **audioProcessorUrl** : URL du worklet (défaut : `/audio-processor.js`).
|
|
46
73
|
- **theme**, **variant**, **size** : apparence du bouton.
|
|
47
74
|
|
|
75
|
+
### Exemple “prod” pour le WebSocket
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<TranscriptionButton
|
|
79
|
+
token="YOUR_API_TOKEN"
|
|
80
|
+
streamingUrlBase="wss://api.votre-domaine.com"
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Dépannage (rapide)
|
|
85
|
+
|
|
86
|
+
- **Erreur / 404 sur `/audio-processor.js`** : copiez bien `node_modules/@ephia/transcribe-sdk/dist/audio-processor.js` vers `public/audio-processor.js` (ou passez `audioProcessorUrl`).
|
|
87
|
+
- **Micro bloqué** : utilisez HTTPS (ou `http://localhost`) et acceptez la permission micro dans le navigateur.
|
|
88
|
+
- **WebSocket KO** : vérifiez `streamingUrlBase` (doit être `ws://` en local, `wss://` en prod) et que votre backend expose bien `/api/v2/streaming/live`.
|
|
89
|
+
- **Bouton “sans style”** : vérifiez l’import `@ephia/transcribe-sdk/dist/styles.css`.
|
|
90
|
+
|
|
48
91
|
## Licence
|
|
49
92
|
|
|
50
93
|
Propriétaire. Voir le fichier LICENSE fourni avec le package.
|
package/package.json
CHANGED