Cyber Week sale: 25% off your first year on annual plans. Ends Dec 6. Start your trial

Video Lightbox Guide: Tested Libraries, Keyboard Behavior, and Licences

Compare GLightbox, Fancybox, and lightGallery using local video tests, measured JavaScript and CSS sizes, keyboard checks, and current commercial licence terms.

James Christensen · December 2, 2026 · 12 min read
Illustration of a video lightbox over a webpage on a laptop

A video lightbox is a dialog that opens a video above the current page. It suits an optional demo or testimonial, but it adds work: move focus into the popup, keep keyboard navigation inside, stop playback on close, and return the visitor to the launch control.

The October 2026 local test compared GLightbox, Fancybox, and lightGallery. All three played the same self-hosted MP4 and stopped it after Escape. The useful differences were the complete video bundle size, initial and returning focus, and the licences needed for a production website.

📋 TL;DR • Fancybox and lightGallery restored focus to the launch control in the local MP4 test; GLightbox did not after keyboard navigation. • GLightbox’s small core was not its full video cost: adding its configured Plyr dependency brought measured minified-and-gzipped JS plus CSS to 54,922 bytes. • Fancybox measured 43,017 bytes; lightGallery core plus its video plugin measured 25,176 bytes. These exclude the video and external provider resources. • All three changed slides with Left/Right arrows. Fancybox recorded focus outside the overlay once in each Tab direction; none of these checks certifies accessibility. • Check licensing before launch: GLightbox is MIT; Fancybox requires a paid production licence; lightGallery offers GPLv3 or a commercial licence.

When should a video lightbox replace an inline player?

A video lightbox fits a secondary video that visitors can skip without losing the page’s main explanation.

A short product demo beside a feature summary is a reasonable candidate. An instructional video whose transcript and related steps need to stay visible is often clearer inline, without an extra dialog to navigate. Choose the popup to preserve page context, not merely to make the player look smaller.

Separate that layout choice from hosting. A popup does not encode video, provide bandwidth, or make an inaccessible player usable. Start with how to embed video on a website, then choose a website video player and the interaction that suits its role.

How were these video lightbox libraries tested?

The video lightbox test used a local HTML fixture, Node.js 22.22.2, and headless Chrome 155.0.8059.84 on Linux.

Each library opened the same three-item gallery: a generated H.264/AAC MP4, a YouTube URL, and a Vimeo URL. Autoplay was disabled for the initial opening; the MP4 was then explicitly started, muted. This kept the local playback check separate from the remote providers’ autoplay and loading behavior.

The keyboard pass sent 20 Tabs and 20 Shift+Tabs, tested Escape, and checked that Right then Left changed the slide index from 0 to 1 and back. Playback checks retained a reference to the actual video element after dismissal, so removing it from the page could not masquerade as a pause.

The isolated pass blocked external network requests. A separate provider pass allowed embedded-player requests while keeping top-level browser navigation on localhost. Provider playback is reported separately from creating an iframe: an overlay that contains an embed URL is not proof that the remote video played successfully.

These are implementation checks, not a performance ranking or a WCAG audit. There was no screen-reader, physical-phone, or cross-browser test. The provider tests below deliberately separate a successful embed opening from actual playback and a successful dismissal; checking only the appearance of the overlay would miss important differences.

Vendor documentation and licence terms were checked in October 2026. The dates on the documentation citations below identify that check, not a publication date.

How much JavaScript and CSS does each video lightbox add?

Video lightbox bundle size depends on the files actually needed for playback, not just the gallery’s core script.

The measurements below minified each selected asset with Terser or clean-css, gzipped each at level 9, then summed the compressed bytes. They are asset-size measurements, not observed page-transfer totals or startup timings. A deferred dependency still belongs in the playback budget even when the first page load does not fetch it.

Library installed Measured configuration JS + CSS, minified and gzipped
GLightbox 3.3.1 Core only 17,876 bytes
GLightbox 3.3.1 Core plus Plyr 3.6.12 JS and CSS 54,922 bytes
Fancybox 6.1.15 (@fancyapps/ui) Fancybox UMD distribution and CSS 43,017 bytes
lightGallery 3.0.0 Core, lgVideo, core CSS, and video CSS 25,176 bytes

In our testing, GLightbox’s dependency changed the size comparison: its video configuration was larger than either of the other tested configurations. Its README documents that Plyr is injected when required; the test served the configured player files locally instead of fetching them from a CDN (GLightbox documentation, 2026).

GLightbox 3.3.1’s packaged settings point to Plyr 3.6.12, which is why that version appears here. The totals exclude MP4 data, provider SDKs, remote player resources, icons, and fonts. Changing the build, player version, caching, or selected plugins changes the result; do not read these numbers as a promise about your live page.

Do the libraries open YouTube, Vimeo, and self-⁠hosted MP4 video?

All three video lightbox libraries opened a playable local MP4 in this fixture.

Fancybox and lightGallery also created YouTube and Vimeo iframe URLs in the network-isolated pass. GLightbox’s hosted-video setup waited on external player APIs, so that isolated pass did not create either provider iframe. That was a dependency boundary, not proof of unsupported formats; the separate online pass tested those provider connections.

Online provider test GLightbox Fancybox lightGallery
YouTube iframe opens Yes Yes Yes
YouTube playback confirmed by advancing API time Yes Yes Yes
Vimeo iframe opens Yes Yes Yes
Vimeo playback confirmed by advancing API time Yes No; provider playback error No; provider playback error

The online pass confirmed YouTube playback in every library. Vimeo’s API reported advancing time under GLightbox, but emitted drminitfailed and PlaybackError without advancing time under Fancybox and lightGallery. Those are observed results for this sample and environment, not evidence that either library lacks Vimeo support or caused the provider failure.

According to Fancyapps’ video guide, Fancybox’s Carousel Video plugin handles HTML5, YouTube, and Vimeo sources. The tested UMD distribution handled the MP4 and provider URLs without a separately added video-plugin script (Fancybox video documentation, 2026).

According to lightGallery’s documentation, video support requires the lgVideo plugin; HTML5 sources use data-video, while hosted sources use their video URL. The fixture loaded that plugin explicitly. Its current settings also describe provider-video facades, which may defer iframe creation until the play button is pressed (Video settings for lightGallery, 2026).

Treat support and playback as separate checks. A provider can deny embedding, a consent tool can block requests, and a browser can reject autoplay. Test your actual video URL, domain restrictions, and consent state before replacing a working inline player with a popup. Keep a useful route to the video outside the dialog.

Which libraries handled Escape, arrows, and focus correctly?

Video lightbox keyboard behavior differed most at opening and closing, not slide navigation.

Every library changed slides with Right/Left arrows and closed with Escape. GLightbox and lightGallery recorded all 20 forward and 20 reverse Tab steps inside; Fancybox recorded 19 of 20 in each direction, with one BODY snapshot outside. These focus results concern the local MP4, not controls inside remote iframes.

Observed behavior GLightbox 3.3.1 Fancybox 6.1.15 lightGallery 3.0.0
Initial focus moves inside overlay No; launch link retained focus Yes Yes
Inside-overlay Tab snapshots, forward / reverse 20/20 / 20/20, after first Tab 19/20 / 19/20 20/20 / 20/20
Right/Left arrows change slides Yes Yes Yes
Escape dismisses the open gallery Yes Yes Yes
Focus after Escape following Tab navigation Page body Launch control Launch control

We noticed that GLightbox’s Tab containment did not mean its whole focus lifecycle was correct: focus initially remained behind the overlay, then landed on the page body after the keyboard pass and Escape. That matters because a keyboard user needs a predictable starting point and a way to resume the page after watching.

According to W3C’s modal dialog pattern, opening moves focus inside, Tab and Shift+Tab remain contained, and Escape closes the dialog. Closing normally returns focus to the invoking element. A visible close button and a useful dialog name belong in the implementation too; darkening the background alone is insufficient.

Fancybox and lightGallery moved focus inside initially and restored the launch control in this fixture, unlike GLightbox’s keyboard pass. Fancybox’s outside-overlay Tab snapshots still mean this test did not establish complete containment. Recheck custom controls, captions, and embedded-player focus on the final page; a focused player may also consume the gallery’s arrow keys.

The online Vimeo check exposed a separate problem: Escape did not dismiss Fancybox or lightGallery while focus was inside the provider iframe. Clicking the visible close button did dismiss both and restored the launch control. Check iframe focus explicitly; the successful local-MP4 Escape result is not a promise about a third-party player’s keyboard handling.

Does the video keep playing after the lightbox closes?

The self-hosted MP4 stopped after Escape in all three video lightbox implementations.

Before close, each video reported paused: false and an advancing playback position. After close, each retained element reference reported paused: true; its timestamp stayed unchanged during the additional 700-millisecond observation. No video element remained connected to the page, and the retained references allowed a check beyond visual dismissal.

We’ve found that retaining the removed element made this check more useful than simply looking for a hidden player: the result established paused state as well as DOM removal. It does not prove that every iframe source, close button, backdrop click, or custom lifecycle hook behaves identically. Test each enabled dismissal route on your integration.

According to MDN, HTMLMediaElement.pause() pauses native media. Use the corresponding documented player API or teardown for an iframe player; calling a native-video method on an iframe is not equivalent. Reopening should have a deliberate resume or restart policy, rather than creating duplicate players behind the page.

For hosted video, dismissal removed every provider iframe in the online pass. Escape was enough for all YouTube tests and GLightbox’s Vimeo test; the visible close button was needed for the other Vimeo tests. That establishes teardown, not a native paused reading. Where Vimeo playback itself failed, continued playback after close could not be tested.

Are Fancybox and lightGallery free for a business website?

Video lightbox licensing is not interchangeable across these libraries, even when all their packages are publicly downloadable.

GLightbox’s MIT licence permits commercial use subject to retaining its copyright and permission notice. Fancybox’s current production terms require a paid licence. lightGallery offers a GPLv3 route and a commercial route for projects that keep their source proprietary; downloading from npm does not settle that choice.

According to Fancyapps’ licence agreement, a Single-Use licence covers one end product for yourself or one client; selling the end product requires the appropriate Business licence. Its restrictions also prohibit use in open-source projects without prior written consent. Do not assume older Fancybox licensing applies to the tested version.

According to lightGallery’s licence page, a product that charges end users needs a Team or Organization licence on the commercial route. Builders, SDKs, and distributable templates have additional Extended Commercial terms. The page says v1/v2 licences do not cover v3, so an existing licence needs checking before upgrading.

The GLightbox permission notice is in its MIT licence. These terms were checked in October 2026; review the current agreement against your deployment before purchasing. This comparison deliberately omits prices, which are less useful than knowing whether your client site, saleable product, or template is covered.

What else should a business website test before launch?

A video lightbox still needs testing on the actual business page, especially on a phone.

Check short viewports, rotation, fullscreen entry and exit, captions, and a reachable close button. The desktop fixture does not establish those results, and a responsive thumbnail says nothing about whether the open player remains usable. Test the actual video and the surrounding page, rather than a library’s demonstration alone.

According to W3C’s media accessibility guide, captions, transcripts, description of important visual information, and an accessible media player are separate concerns. Dialog focus does not replace them. Use the video accessibility guide and captioning walkthrough when preparing the content itself.

Check network requests before and after the first play click. The overlay does not automatically defer player scripts or video bytes, and deferred loading can change the wait after a click. Keep this separate from the work of video CDN delivery and the tradeoffs of direct WordPress video uploads.

If the popup works but hosting and brand presentation still need attention, compare SmartVideo’s feature overview and plans. Choose the host separately, then repeat initialization, captions, focus, and pause-on-close checks with its actual player. These library tests are not a tested SmartVideo integration.

What are the common video lightbox questions?

What is a video lightbox?

A video lightbox opens a video in a dialog over the current page. It can keep an optional demo close to its context, but it must handle opening focus, keyboard navigation, dismissal, and returning the viewer to the page. It is not a video host or an accessibility guarantee.

Which video lightbox library should I choose?

Shortlist Fancybox or lightGallery if the tested focus lifecycle matches your needs and the licence fits. Consider GLightbox when its MIT terms suit the project, but budget for player dependencies and focus repair. The measurements compare these specific configurations, not every possible build or device.

Can a lightbox play self-⁠hosted MP4 video?

Yes. All three tested libraries opened the local MP4, played it, and paused it after Escape. Your own file still needs a compatible encoding and reliable delivery. A successful local test does not establish how a large file performs over a slow connection or under production traffic.

Does closing the popup stop the video automatically?

It did for the MP4 and Escape route in this test. Do not generalize that to every hosted player or dismissal route. Test the close button and any enabled backdrop action while playback is active, then check both visible state and whether audio continues after the popup disappears.

Should a video lightbox trap keyboard focus?

Yes. Keep Tab and Shift+Tab inside the open modal, move focus inside on opening, and normally restore it to the invoking control on close. The GLightbox result shows why checking Tab alone is insufficient: containment can work while initial focus and focus restoration still need attention.

Is Fancybox free for commercial use?

Not under its current production terms. Fancyapps requires a paid licence, with different coverage for a client website and a saleable end product. Check the agreement for the version you deploy. A public npm package or an older tutorial describing different terms does not grant production permission.

Is lightGallery free for a proprietary website?

lightGallery offers GPLv3 and commercial licensing. Its current page directs projects that keep their source proprietary to a commercial licence, with additional conditions for saleable products and redistributable builders or templates. Check the current terms rather than treating its open-source option as permission for every deployment.

Do I still need captions and phone testing?

Yes. The dialog and the video solve different accessibility problems. Supply captions and an accessible player, then test on a real phone with rotation, fullscreen, touch controls, and the browser interface visible. The headless desktop checks here did not exercise screen readers or physical mobile devices.

What should you do next?

Choose a video lightbox for the interaction you need, then verify its licence and repeat these checks on your own page.

Try SmartVideo Free for Your Site →

Keep Visitors on Your Page, Not YouTube’s

SmartVideo’s player is 2x lighter than a YouTube embed, with zero ads. No suggested videos, no one else’s logo.

Build your player
10% conversion increase
“We’ve had a 10% increase in conversion rate from lead to customer.”
Pedro C.
Dir. of Digital Marketing, White Jacobs
Instant side-by-side winner
“SmartVideo loaded immediately; YouTube took 5 seconds to start. It became a no-brainer.”
Aaron H.
IT Director, PizzaTV
Rankings improved
“Our search-engine rankings went up after we switched over to Swarmify.”
Philip A.
Owner, Ignite Images