Skip to main content

Update Configuration

If you'd like to update the configuration after the widget is configured, there's a simple method to do this:

SpeechifyWidget.updateConfiguration(newConfiguration: SpeechifyPlayerConfig)

Example

The below example will start with the play button enlarged by 10%, and after 5 seconds it will be enlarged by 20%.

import("https://storage.googleapis.com/speechify-api-cdn/speechifyapi.min.mjs").then(async (speechifyWidget) => {
// widget configuration
const config = {
rootElement: document.getElementById("article"),
useSpeechifyRoot: true,
customStyles: { playButton: "transform: scale(1.1)" },
};
// initialize the widget with config and mount it on the page
const widget = speechifyWidget.makeSpeechifyExperience(config);
await widget.mount();

// after 5 seconds, enlarge the play button by 20% instead of 10%
setTimeout(() => {
await widget.updateConfiguration({
customStyles: { playButton: "transform: scale(1.2)" },
});
}, 5000);
});

For more information on configuration options, see the configuration documentatation.