@readium/speech 0.4.0 → 0.5.0

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.
@@ -5,7 +5,7 @@ export interface ReadiumSpeechPlaybackEvent {
5
5
  type: "start" | "pause" | "resume" | "end" | "stop" | "skip" | "error" | "boundary" | "mark" | "idle" | "loading" | "ready" | "voiceschanged" | "languagefallback";
6
6
  detail?: any;
7
7
  }
8
- export interface ReadiumSpeechNavigator {
8
+ export interface ReadiumSpeechNavigatorContract {
9
9
  getVoices(): Promise<ReadiumSpeechVoice[]>;
10
10
  setVoice(voice: ReadiumSpeechVoice | string): void;
11
11
  getCurrentVoice(): ReadiumSpeechVoice | null;
@@ -0,0 +1,19 @@
1
+ import { ReadiumSpeechEngineProvider } from './provider';
2
+ import { ReadiumSpeechPlaybackEngine } from './engine';
3
+ import { ReadiumSpeechVoice } from './voices/types';
4
+ export interface ReadiumSpeechProviderVoices {
5
+ providerId: string;
6
+ voices: ReadiumSpeechVoice[];
7
+ }
8
+ export declare class ReadiumSpeechProviderRegistry {
9
+ private providers;
10
+ register(provider: ReadiumSpeechEngineProvider): void;
11
+ unregister(providerId: string): void;
12
+ get(providerId: string): ReadiumSpeechEngineProvider | undefined;
13
+ list(): ReadiumSpeechEngineProvider[];
14
+ getVoices(providerId: string): Promise<ReadiumSpeechVoice[]>;
15
+ getAllVoices(): Promise<ReadiumSpeechProviderVoices[]>;
16
+ createEngine(providerId: string, voice?: ReadiumSpeechVoice | string): Promise<ReadiumSpeechPlaybackEngine>;
17
+ destroy(): Promise<void>;
18
+ private require;
19
+ }
@@ -1,13 +1,13 @@
1
- import { ReadiumSpeechPlaybackEngine } from '../engine';
2
- import { ReadiumSpeechNavigator, ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator';
3
- import { ReadiumSpeechUtterance } from '../utterance';
4
- import { ReadiumSpeechVoice } from '../voices/types';
5
- export declare class WebSpeechReadAloudNavigator implements ReadiumSpeechNavigator {
1
+ import { ReadiumSpeechPlaybackEngine } from './engine';
2
+ import { ReadiumSpeechNavigatorContract, ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from './navigator';
3
+ import { ReadiumSpeechUtterance } from './utterance';
4
+ import { ReadiumSpeechVoice } from './voices/types';
5
+ export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorContract {
6
6
  private engine;
7
7
  private contentQueue;
8
8
  private eventListeners;
9
9
  private navigatorState;
10
- constructor(engine?: ReadiumSpeechPlaybackEngine);
10
+ constructor(engine: ReadiumSpeechPlaybackEngine);
11
11
  private initializeEngine;
12
12
  private setupEngineListeners;
13
13
  private setNavigatorState;
@@ -13,7 +13,17 @@ export type TLocalizedName = "android" | "apple";
13
13
  /**
14
14
  * Source of the voice data
15
15
  */
16
- export type TSource = "json" | "browser";
16
+ export type TSource = "json" | "browser" | "server";
17
+ /**
18
+ * Controls a speech-server voice reports as enabled, e.g. {ssml: true}.
19
+ * A control absent from this object is not supported by that voice.
20
+ */
21
+ export interface TServerVoiceControls {
22
+ pitch?: boolean;
23
+ speed?: boolean;
24
+ ssml?: boolean;
25
+ boundary?: boolean;
26
+ }
17
27
  /**
18
28
  * Supported operating systems for voices
19
29
  */
@@ -70,6 +80,8 @@ export interface ReadiumSpeechVoice {
70
80
  nativeID?: string | string[];
71
81
  note?: string;
72
82
  provider?: string;
83
+ identifier?: string;
84
+ controls?: TServerVoiceControls;
73
85
  isDefault?: boolean;
74
86
  offlineAvailability?: boolean;
75
87
  isNovelty?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/speech",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A TypeScript library for implementing read aloud features with Web technologies, following best practices for digital publishing.",
5
5
  "author": "Readium Foundation",
6
6
  "keywords": [