FAQ
A correct URL was passed but the lightbox displays an "Invalid source" message.
Most likely an external URL without the CORS enabled was used, so the lightbox cannot detect its type automatically. The issue can by solved by manually setting the source's type, or enabling the CORS of the given resource, or putting the file on the local server.
The lightbox doesn't change the sources after the prop update.
The "sources" prop is not reactive. To determine how to update this prop, go to the "Updating props" section.
How to pause videos on a slide change?
It's possible only in the pro version as the "onSlideChange" event is not provided in the basic one. The following example describes how to pause both HTML and YouTube videos (so you might want to modify it if you are using only HTML or only YouTube videos):
<FsLightbox
onSlideChange={function (instance) {
var sources = instance.elements.sources;
for (var i = 0; i < sources.length; i++) {
var source = sources[i].current;
if (!source) {
continue;
}
if (source.tagName === "VIDEO") {
source.pause();
} else if (source.tagName === "IFRAME") {
source.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*");
}
}
}}
/>