@corti/dictation-web 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +45 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Corti Dictation SDK
2
2
 
3
3
  ## Overview
4
+
4
5
  The **Corti Dictation SDK** is a web component that enables real-time speech-to-text dictation using Corti's Dictation API. It provides a simple interface for capturing audio, streaming it to the API, and handling transcripts.
5
6
 
6
7
  > **Note:** OAuth 2.0 authentication is not handled by this SDK. The client must provide an API key or authorization token before using the component.
7
8
 
8
-
9
9
  ## Installation
10
10
 
11
11
  Include the SDK in your project by importing the JavaScript module:
@@ -14,6 +14,13 @@ Include the SDK in your project by importing the JavaScript module:
14
14
  npm i @corti/dictation-web
15
15
  ```
16
16
 
17
+ ```html
18
+ <script
19
+ src="https://cdn.jsdelivr.net/npm/@corti/dictation-web/dist/bundle.min.js"
20
+ preload
21
+ type="module"
22
+ ></script>
23
+ ```
17
24
 
18
25
  ## Usage
19
26
 
@@ -21,74 +28,74 @@ npm i @corti/dictation-web
21
28
 
22
29
  🚀 [Hosted Demo](https://codepen.io/hccullen/pen/OPJmxQR)
23
30
 
24
-
25
31
  ### Basic Example
26
32
 
27
33
  ```html
28
34
  <!DOCTYPE html>
29
35
  <html lang="en">
30
- <head>
31
- <meta charset="UTF-8">
32
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
33
- </head>
34
- <body>
35
- <script src="https://cdn.jsdelivr.net/npm/@corti/dictation-web/dist/index.min.js"></script>
36
- <corti-dictation authToken="xyz"></corti-dictation>
37
- <textarea id="transcript" placeholder="Transcript will appear here..."></textarea>
38
-
39
- <script>
40
- const dictationEl = document.getElementById('transcript')
41
- // Listen for events
42
- dictationEl.addEventListener('transcript', (e) => {
43
- document.getElementById('transcript').value += e.detail.data.text + ' ';
44
- });
45
- </script>
46
- </body>
36
+ <body>
37
+ <script
38
+ src="https://cdn.jsdelivr.net/npm/@corti/dictation-web/dist/bundle.min.js"
39
+ preload
40
+ type="module"
41
+ ></script>
42
+ <corti-dictation authToken="xyz"></corti-dictation>
43
+ <textarea
44
+ id="transcript"
45
+ placeholder="Transcript will appear here..."
46
+ ></textarea>
47
+
48
+ <script>
49
+ const dictationEl = document.getElementById('transcript');
50
+ // Listen for events
51
+ dictationEl.addEventListener('transcript', e => {
52
+ document.getElementById('transcript').value += e.detail.data.text + ' ';
53
+ });
54
+ </script>
55
+ </body>
47
56
  </html>
48
57
  ```
49
58
 
50
-
51
59
  ## API Reference
52
60
 
53
61
  ### Properties
54
62
 
55
- | Property | Type | Description |
56
- |-----------------|---------|-------------|
57
- | `devices` | Array | List of available recording devices. |
58
- | `recordingState` | String | Current state of recording (`stopped`, `recording`). |
59
- | `dictationConfig` | Object | Configuration settings for dictation. |
60
- | `authToken` | String | Authentication token from OAuth server |
63
+ | Property | Type | Description |
64
+ | ----------------- | ------ | ---------------------------------------------------- |
65
+ | `devices` | Array | List of available recording devices. |
66
+ | `recordingState` | String | Current state of recording (`stopped`, `recording`). |
67
+ | `dictationConfig` | Object | Configuration settings for dictation. |
68
+ | `authToken` | String | Authentication token from OAuth server |
61
69
 
62
70
  ### Methods
63
71
 
64
- | Method | Description |
65
- |---------------------|-------------|
72
+ | Method | Description |
73
+ | ------------------- | -------------------------- |
66
74
  | `toggleRecording()` | Starts or stops recording. |
67
75
 
68
76
  ### Events
69
77
 
70
- | Event | Description |
71
- |----------------------------|-------------|
72
- | `recording-state-changed` | Fired when the recording state changes. `detail.state` contains the new state. |
78
+ | Event | Description |
79
+ | -------------------------- | --------------------------------------------------------------------------------------------- |
80
+ | `recording-state-changed` | Fired when the recording state changes. `detail.state` contains the new state. |
73
81
  | `recording-device-changed` | Fired when the user switches recording devices. `detail.deviceId` contains the new device ID. |
74
- | `transcript` | Fired when a new transcript is received. `detail.data.text` contains the transcribed text. |
75
- | `audio-level-changed` | Fired when the input audio level changes. `detail.audioLevel` contains the new level. |
76
-
82
+ | `transcript` | Fired when a new transcript is received. `detail.data.text` contains the transcribed text. |
83
+ | `audio-level-changed` | Fired when the input audio level changes. `detail.audioLevel` contains the new level. |
84
+ | `error` | Fired on error. `detail` contains the full error. |
77
85
 
78
86
  ## Authentication
79
87
 
80
88
  This SDK does not handle OAuth 2.0 authentication. The client must provide an API key or access token as a string in `authToken`.
81
89
 
82
-
83
90
  ## Notes
91
+
84
92
  - Works in modern browsers that support Web Components and MediaRecorder API.
85
93
  - Supports dark and light mode based on browser preference.
86
94
 
87
-
88
95
  ## License
89
- This SDK is not licensed.
90
96
 
97
+ This SDK is not licensed.
91
98
 
92
99
  ## Support
93
- For issues or questions, contact **Corti Support** at [support@corti.ai](mailto:support@corti.ai).
94
100
 
101
+ For issues or questions, contact **Corti Support** at [support@corti.ai](mailto:support@corti.ai).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@corti/dictation-web",
3
3
  "description": "Web component for Corti Dictation",
4
4
  "author": "Corti ApS",
5
- "version": "0.1.4",
5
+ "version": "0.1.5",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",