stt library
语音转字幕入口:识别端口、字幕、模型与存储接缝及配置。 本包不内置识别器,IMovaApi.stt 继续保留。 模型下载为实验实现,当前下载与缓存行为保持不变。 mova.dart 仅保留一个版本的兼容转导出,请迁移为 package:mova/stt.dart。
Classes
- IMovaAudioPuller
-
Decodes a media source's entire audio track to a WAV file on disk, for
one-shot batch transcription of VOD content (see
doc/notes/2026-08-04-stt-recognizer-decision.md's "批量预转写" section). - IMovaStt
- A port that turns a stream of decoded PCM audio into recognized subtitle cues.
- IMovaSttApi
-
The speech-to-text subtitle capability surface exposed on
IMovaApi.stt. - IMovaSttChunkSubtitleStore
-
Caches per-chunk transcription results for the streaming-chunked STT
pipeline (see
doc/plans/2026-08-06-stt-streaming-chunked-transcription.md), keyed by(sourceKey, chunkIndex)— a distinct concept from IMovaSttSubtitleStore, which caches one whole-source result from a single-shot batch transcription. Re-opening the same source only re-queues the chunks that never finished;SttChunkState.donechunks load straight from here. - IMovaSttModelDirProvider
- Resolves the on-disk directory downloaded STT model files are cached in.
- IMovaSttModelProvider
- Downloads and caches an MovaSttModelSpec's files on disk, skipping files already cached, and resolves to their local paths once every file is present.
- IMovaSttSession
-
可选的会话感知能力;旧的
implements IMovaStt无需新增成员。 实现者须在发起异步识别时捕获代际,并写入产出的 cue,不能在完成时读取最新值。 示例:final epoch = currentEpoch; recognize().then((text) => emit(cueWith(epoch)))。 - IMovaSttSubtitleDirProvider
- Resolves the on-disk directory pre-generated (batch) subtitle files are cached in.
- IMovaSttSubtitleStore
- Caches a batch-transcribed cue list on disk, keyed by source, so a VOD only ever gets transcribed once regardless of how many times it's re-watched.
- MovaAudioExtractor
-
⚠️ Unverified spike, not a settled implementation. A candidate
IMovaAudioPuller built on mpv's
ao=pcm/ao-pcm-fileaudio-output driver (documented mpv behavior: it decodes straight to a WAV file instead of a real audio device) via a second, headless media_kitPlayer— the same "second hidden player" pattern MovaFrameExtractor uses for frame extraction, just for audio. - MovaFileSttChunkSubtitleStore
-
The production IMovaSttChunkSubtitleStore: one
.srtfile per(sourceKey, chunkIndex)pair, named by fnv1a64 of a composite key — same key-shape convention as MovaFileSttSubtitleStore and the scrub-preview cache'sdefaultCacheKey. - MovaFileSttSubtitleStore
-
The production IMovaSttSubtitleStore: one
.srtfile per source, named by fnv1a64 ofsourceKey(same key-shape convention as the scrub-preview cache'sdefaultCacheKey). - MovaFixedSttModelDirProvider
- A IMovaSttModelDirProvider that always returns one fixed path.
- MovaFixedSttSubtitleDirProvider
- A IMovaSttSubtitleDirProvider that always returns one fixed path.
- MovaNoopStt
- A zero-dependency IMovaStt no-op: recognizes nothing, emits no cues.
- MovaSttCue
- One recognized text span, with the media-position range it covers.
- MovaSttModelFile
-
One file a model needs, already extracted and individually downloadable
(not a
.tar.bz2bundle — seedoc/notes/2026-08-04-stt-recognizer-decision.mdfor why: sherpa-onnx's official GitHub Releases ship archives, so the default source re-hosts the already-extracted plain files rather than decompressing on-device). - MovaSttModelFiles
- The resolved local paths for a MovaSttModelSpec once every file is cached.
- MovaSttModelLoader
- The production IMovaSttModelProvider: one sub-directory per model id, skipping files whose cached size already matches MovaSttModelFile.sizeBytes.
- MovaSttModelProg
- One step of progress while IMovaSttModelProvider.ensure downloads a spec's files.
- MovaSttModelSpec
- A named, versioned set of files one STT recognizer needs on disk before it can be constructed.
- MovaSttOpts
-
Options for speech-to-text subtitles, disabled by default.
recognizer is the host-owned recognizer injection point; null means no
recognition (see MovaNoopStt). This package bundles no recognizer.
Configure it through
options.stt, not a factory-levelsttparameter: - MovaSttService
- The production IMovaSttApi: forwards cues from the configured MovaSttOpts.recognizer, tracks which cue covers the current playback position, and refuses start with a MovaSttBlockReason when the feature is disabled, unconfigured, or no source is open.
- MovaTempSttModelDirProvider
-
The default IMovaSttModelDirProvider: a named folder under the platform's
persistent application-support directory, e.g.
<app support>/mova_stt_models. - MovaTempSttSubtitleDirProvider
-
The default IMovaSttSubtitleDirProvider: a named folder under the
platform's persistent application-support directory, e.g.
<app support>/mova_stt_subtitles.
Enums
- MovaSttBlockReason
-
Why an STT
startrequest was refused before any recognition happened.
Functions
-
formatSrt(
List< MovaSttCue> cues) → String -
Formats
cuesas SubRip (.srt) text, one block per cue, in the order given (callers are responsible for pre-sorting if that matters). -
parseSrt(
String text) → List< MovaSttCue> -
Parses SubRip (
.srt) text into an ordered list of MovaSttCues.
Typedefs
- MovaSttBlockCb = void Function(MovaSttBlockReason reason)
-
Notified when a
startrequest is refused; the default is silence.
Exceptions / Errors
- MovaSttModelLoadError
- Thrown by IMovaSttModelProvider.ensure when a file could not be obtained.