@phont-ai/subtitles-core
v0.2.1
Published
Core subtitle engine for PHONT expressive subtitles - pure TypeScript, framework-agnostic
Downloads
245
Readme
@phont/subtitles-core
Core subtitle engine for PHONT expressive subtitles. Pure TypeScript, framework-agnostic.
Purpose
This package contains the core logic for:
- Subtitle timing and synchronization
- Emotion detection and style mapping
- Word-by-word karaoke mode
- API client for fetching subtitle data
Usage
import { createSubtitleEngine, SubtitleTrack } from '@phont/subtitles-core';
const track: SubtitleTrack = {
vodId: 'video-123',
language: 'en',
lines: [/* ... */]
};
const engine = createSubtitleEngine(track);
const state = engine.at(42.5); // Get subtitle state at 42.5 secondsDevelopment
# Build
pnpm build
# Watch mode
pnpm dev
# Test
pnpm test
# Type check
pnpm typecheckExtraction Plan
This package will be created by extracting logic from:
app/hooks/subtitle/useSentenceAnimation.js→src/engine.tsapp/hooks/subtitle/useWordAnimation.js→src/engine.tsapp/config/animation/→src/emotionMapper.tsapp/components/subtitle/data/SubtitleFetcher.js→src/client.ts
