@allior/wmake-tts
v0.0.6
Published
TTS plugin for StreamElements widgets
Downloads
112
Readme
@allior/wmake-tts
Language / Язык: English | Русский
TTS plugin for StreamElements widgets. Uses StreamElements Speech API.
Usage
import { plugTTS } from "@allior/wmake-tts";
window.addEventListener("onWidgetLoad", (event) => {
plugTTS(event, {
shouldIgnoreMessage: (data) => false,
getAnimationElement: (msgId) =>
document.querySelector(`[data-msgid="${msgId}"] .mascot`) ?? null,
});
});API
- plugTTS(onWidgetLoadEvent, options?) — init from fieldData (ttsEnabled, ttsVoice, ttsVolume, ttsRate, apiToken), subscribe to
onEventReceivedfor messages. - cleanTextForTTS(text) — replace URLs with "link", strip emoticon sequences, trim.
- voices / voicesMap — voice list from voices.json (VoiceEntry by id).
- addToTTSQueue(text, msgId?) — queue text for playback.
Options: shouldIgnoreMessage, getAnimationElement, unlockAudio.
