Official TypeScript library providing comprehensive client access to Mux's video infrastructure API including asset management, live streaming, analytics, and webhook handling
Transcription vocabulary management for improving automated speech recognition accuracy. Transcription vocabularies contain custom phrases, words, and proper names that boost recognition probability for live stream subtitles.
Create custom vocabulary lists to improve transcription accuracy for domain-specific terminology.
/**
* Create a new Transcription Vocabulary
* @param body - Vocabulary creation parameters
* @returns Promise resolving to the created vocabulary
*/
create(
body: TranscriptionVocabularyCreateParams,
options?: Core.RequestOptions
): Core.APIPromise<TranscriptionVocabulary>;
interface TranscriptionVocabularyCreateParams {
/** Phrases, words, or proper names to boost recognition probability */
phrases: Array<string>;
/** Optional user-supplied name for the vocabulary */
name?: string;
/** Optional metadata (max 255 characters) */
passthrough?: string;
}Usage Example:
import Mux from "@mux/mux-node";
const mux = new Mux({
tokenId: process.env.MUX_TOKEN_ID,
tokenSecret: process.env.MUX_TOKEN_SECRET,
});
// Create vocabulary for technical terms
const vocabulary = await mux.video.transcriptionVocabularies.create({
name: "Mux API Vocabulary",
phrases: [
"Mux",
"Live Stream",
"Playback ID",
"video encoding",
"RTMP",
"Stream Key"
]
});
console.log(`Created vocabulary: ${vocabulary.id}`);Retrieve details of existing transcription vocabularies.
/**
* Retrieve a Transcription Vocabulary by ID
* @param transcriptionVocabularyId - Unique vocabulary identifier
* @returns Promise resolving to the vocabulary details
*/
retrieve(
transcriptionVocabularyId: string,
options?: Core.RequestOptions
): Core.APIPromise<TranscriptionVocabulary>;Usage Example:
const vocabulary = await mux.video.transcriptionVocabularies.retrieve(
"TRANSCRIPTION_VOCABULARY_ID"
);
console.log(`Vocabulary "${vocabulary.name}" contains ${vocabulary.phrases?.length} phrases`);Update existing vocabularies while maintaining live stream associations.
/**
* Update a Transcription Vocabulary
* @param transcriptionVocabularyId - Vocabulary to update
* @param body - Updated vocabulary parameters
* @returns Promise resolving to the updated vocabulary
*/
update(
transcriptionVocabularyId: string,
body: TranscriptionVocabularyUpdateParams,
options?: Core.RequestOptions
): Core.APIPromise<TranscriptionVocabulary>;
interface TranscriptionVocabularyUpdateParams {
/** Updated phrases, words, or proper names */
phrases: Array<string>;
/** Updated name for the vocabulary */
name?: string;
/** Updated metadata (max 255 characters) */
passthrough?: string;
}Usage Example:
const updatedVocabulary = await mux.video.transcriptionVocabularies.update(
"TRANSCRIPTION_VOCABULARY_ID",
{
name: "Mux API Vocabulary - Updated",
phrases: ["Mux", "Live Stream", "RTMP", "Stream Key", "HLS", "DASH"]
}
);List and paginate through all transcription vocabularies.
/**
* List all Transcription Vocabularies with pagination
* @param query - Optional pagination parameters
* @returns PagePromise for iterating through vocabularies
*/
list(
query?: TranscriptionVocabularyListParams,
options?: Core.RequestOptions
): Core.PagePromise<TranscriptionVocabulariesBasePage, TranscriptionVocabulary>;
interface TranscriptionVocabularyListParams extends BasePageParams {
/** Page number for pagination */
page?: number;
/** Number of items per page */
limit?: number;
}Usage Example:
// Auto-pagination through all vocabularies
for await (const vocabulary of mux.video.transcriptionVocabularies.list()) {
console.log(`Vocabulary: ${vocabulary.name} (${vocabulary.phrases?.length} phrases)`);
}
// Manual pagination
const page = await mux.video.transcriptionVocabularies.list({
page: 1,
limit: 10
});Delete vocabularies while preserving active live stream associations.
/**
* Delete a Transcription Vocabulary
* @param transcriptionVocabularyId - Vocabulary to delete
* @returns Promise that resolves when deletion completes
*/
delete(
transcriptionVocabularyId: string,
options?: Core.RequestOptions
): Core.APIPromise<void>;Usage Example:
await mux.video.transcriptionVocabularies.delete("TRANSCRIPTION_VOCABULARY_ID");
console.log("Vocabulary deleted successfully");interface TranscriptionVocabulary {
/** Unique identifier for the Transcription Vocabulary */
id: string;
/** Creation timestamp (Unix seconds since epoch) */
created_at: string;
/** Last update timestamp (Unix seconds since epoch) */
updated_at: string;
/** Optional user-supplied name */
name?: string;
/** Optional metadata (max 255 characters) */
passthrough?: string;
/** Array of phrases, words, or proper names */
phrases?: Array<string>;
}
interface TranscriptionVocabularyResponse {
data: TranscriptionVocabulary;
}
/** Pagination wrapper for vocabulary listing */
class TranscriptionVocabulariesBasePage extends BasePage<TranscriptionVocabulary> {}Transcription vocabularies are used with live streams to improve subtitle accuracy:
// Create a live stream with transcription vocabulary
const liveStream = await mux.video.liveStreams.create({
playback_policy: ["public"],
generated_subtitles: [
{
name: "English",
language_code: "en",
transcription_vocabulary_ids: [vocabulary.id]
}
]
});Install with Tessl CLI
npx tessl i tessl/npm-mux--mux-nodedocs