Developer SDK · JavaScript API v1.0
SayItVid JavaScript API
Embed interactive, authentic video pronunciation clips directly in your dictionary, blog, or language learning app. Fast, responsive, and drop-in compatible.
⚡ <10ms Search Latency🎯 IPA & CEFR Level Included🔄 Zero-Refactor Drop-in🆓 Free for Dictionaries & Education
Interactive Popup Demo
See the Widget in an Editorial Article
Explore our live interactive article demo where every word is clickable to launch an authentic video pronunciation popup.
Getting Started
<!-- 1. Include a container element -->
<div id="sayitvid-player" style="max-width: 640px; margin: 0 auto;"></div>
<!-- 2. Load the lightweight SayItVid SDK -->
<script src="https://sayitvid.com/widget.js" async></script>
<!-- 3. Initialize and search -->
<script>
function onSayItVidAPIReady() {
var player = new SayItVid.Widget("sayitvid-player", {
width: 640,
height: 420,
theme: "auto", // 'light' | 'dark' | 'auto'
events: {
onFetchDone: function(event) {
console.log("Total clips found:", event.totalResult);
},
onCaptionConsumed: function(event) {
console.log("Clip finished. Auto-playing next...");
player.next();
}
}
});
// Load authentic clips for any word or phrase in any supported language
player.fetch("courage", "en");
}
</script>Complete API Reference
Widget Instance Methods
| Method | Parameters | Description |
|---|---|---|
| widget.fetch(query, lang) | query: stringlang: optional string ('en', 'tr', 'de', 'es', 'fr', 'it', 'pt', etc.) | Dynamically queries and plays authentic video clips for the word without reloading the iframe. |
| widget.setLanguage(lang) | lang: string ('en', 'tr', 'de', 'es', 'fr', 'it', 'pt', etc.) | Switches the active search language for all subsequent queries. |
| widget.play() | None | Starts playback of the currently loaded video clip. |
| widget.pause() | None | Pauses video playback. |
| widget.replay() | None | Seeks to the clip start timestamp and resumes playback. |
| widget.next() | None | Advances to the next authentic clip in the search result set. |
| widget.previous() | None | Goes back to the previous video clip. |
| widget.setSpeed(speed) | speed: number (e.g. 0.75, 1.0) | Adjusts the playback rate of the audio/video. |
| widget.setTheme(theme) | theme: string ('light', 'dark', 'system') | Dynamically switches between light, dark, and system color schemes. |
| widget.destroy() | None | Removes postMessage listeners and clears the DOM element. |
Event Listeners (Options.events)
| Event Name | Callback Payload | Use Case |
|---|---|---|
| onFetchDone | { query, lang, totalResult, clip } | Triggered after search finishes. Check event.totalResult === 0 to show "no video found" UI. |
| onVideoChange | { trackNumber, totalTracks, videoId, startTime, text, lang } | Fired when advancing or switching to a new video clip. |
| onCaptionConsumed | { trackNumber, totalTracks, videoId } | Fired precisely when the spoken sentence completes. Ideal for auto-repeating 3 times or launching a quiz! |
| onPlayerStateChange | { state: "playing" | "paused" } | Track when end-users interact with playback controls. |
| onError | { error: string } | Handles network timeouts or unsupported words gracefully. |
Direct HTML Iframe Embedding
If you prefer not to use JavaScript, you can embed the SayItVid Player directly as a clean, responsive HTML iframe without any external script dependencies.
<iframe src="https://sayitvid.com/embed/word/courage?lang=en&theme=auto&autoStart=1" width="100%" height="420" style="border: none; border-radius: 12px; overflow: hidden; max-width: 640px; display: block;" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen loading="lazy" title="SayItVid Pronunciation Player"> </iframe>
| URL Parameter | Default | Description |
|---|---|---|
| /embed/word/:word | - | The word or phrase to display native video pronunciations for. |
| lang | 'en' | Language code: en, tr, de, fr, es, it, pt, ru, nl, pl, ja, etc. |
| theme | 'auto' | Color scheme: auto, light, or dark. |
| autoStart | 1 | Set to 0 to require a click on the play overlay before loading video. |
Online Dictionaries & Educational Platforms
Online Dictionaries & Language Apps — Get 100% Free Lifetime Enterprise Access.
If you are an online dictionary platform, vocabulary app, or educational institution looking for authentic video pronunciation, SayItVid offers you free dedicated high-capacity enterprise quota in exchange for standard attribution.