@pie-players/pie-tool-tts-inline 0.3.50 → 0.3.51
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 +20 -3
- package/dist/tool-tts-inline.js +513 -508
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ toolCoordinator.showTool('tts-passage-1');
|
|
|
99
99
|
|
|
100
100
|
- `ttsService` - ITTSService instance (required)
|
|
101
101
|
- `coordinator` - IToolCoordinator instance (optional, for visibility management)
|
|
102
|
-
- `speedOptions` - Optional
|
|
102
|
+
- `speedOptions` - Optional speed options controlling inline speed button rendering
|
|
103
103
|
|
|
104
104
|
### `speedOptions` Configuration
|
|
105
105
|
|
|
@@ -112,12 +112,28 @@ const ttsButton = document.createElement("pie-tool-tts-inline");
|
|
|
112
112
|
ttsButton.speedOptions = [2, 1.25, 1.5]; // rendered in this order
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
For hosts that need semantic button copy, pass object-form options. `rate`
|
|
116
|
+
still controls playback; `label` and `ariaLabel` only control visible and
|
|
117
|
+
accessible text.
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
ttsButton.speedOptions = [
|
|
121
|
+
{ rate: 0.8, label: "Slow", ariaLabel: "Slow speed" },
|
|
122
|
+
{ rate: 1.5, label: "Fast", ariaLabel: "Fast speed" }
|
|
123
|
+
];
|
|
124
|
+
```
|
|
125
|
+
|
|
115
126
|
Semantics:
|
|
116
127
|
|
|
117
128
|
- Omitted or non-array: defaults to `[0.8, 1.25]`.
|
|
118
129
|
- Explicit `[]`: no speed buttons rendered.
|
|
119
130
|
- Invalid-only values: fall back to `[0.8, 1.25]`.
|
|
120
|
-
-
|
|
131
|
+
- Numeric values and object `rate` values are deduplicated while preserving
|
|
132
|
+
first-seen order.
|
|
133
|
+
- Numeric options render as `{rate}x` with accessible names like
|
|
134
|
+
`Speed {rate}x`.
|
|
135
|
+
- Object options can customize labels; missing labels fall back to `{rate}x`,
|
|
136
|
+
and missing `ariaLabel` values fall back to matching names like `Fast speed`.
|
|
121
137
|
- `1` is excluded from rendered options.
|
|
122
138
|
|
|
123
139
|
## Behavior
|
|
@@ -135,7 +151,8 @@ Semantics:
|
|
|
135
151
|
- Play/Pause toggles based on playback state
|
|
136
152
|
- Stop halts playback and closes the panel
|
|
137
153
|
- Fast-forward/Rewind invoke sentence-jump seek on `ITTSService`
|
|
138
|
-
- Speed buttons call `ttsService.
|
|
154
|
+
- Speed buttons call `ttsService.setPlaybackRate(rate)` when available,
|
|
155
|
+
otherwise `ttsService.updateSettings({ rate })`
|
|
139
156
|
- Selecting another speed switches active state to that option
|
|
140
157
|
- Clicking the currently active speed resets back to `1x`
|
|
141
158
|
- If `speedOptions` is `[]`, speed controls are omitted while rewind/forward/stop still render
|