Problem/Motivation
This module includes the GLightbox library from packagist, which is great, but then the library itself uses CDN to load plyr.io by default.
Proposed resolution
Load the GLightbox object using custom options to mark what the location of the plyr.io library is (if found).
Remaining tasks
Add a plyr.io library that falls back to CDN.
If the library is present locally, use that in the glightbox.js main file.
Working on a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | e9b3b2751f7b24ada507a4aecc405b9e.png | 28 KB | levmyshkin |
| #8 | 19ffde8732b20d0f22f09b5a3c69003a.png | 13.7 KB | levmyshkin |
| #8 | 5b5a6d62f3608260fd6c88e055585ee2.png | 30.98 KB | levmyshkin |
| #4 | b56cfd533b28a82c2be14e8981648447.png | 22.21 KB | levmyshkin |
Issue fork glightbox-3487303
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
pcambraI've just seen that the plyr.io library requires two hardcoded files from the CDN: https://github.com/sampotts/plyr/blob/a148e2e5b6eb4cda1d63a21397636a365f... that glightbox js library doesn't allow to customise, so in order to avoid those svg/mp4 calls remotely, an additional PR to https://github.com/levmyshkin/glightbox/blob/ec02687a888436767b2800f949a...
Comment #4
levmyshkinHi pcambra, thank you for your MR! I didn't realize that GLightbox uses 3rd party player, I thought it was native video player. I'd prefer to fork plyr video player, the lastest release was in 24th March 2023, I don't think that it will be updated often. Usually I pull releases in forked repository it didn't take too much time.
Also we need to keep ability to download this Plyr player locally to make it's working without internet access. I'm going also add settings for Plyr player in GLightbox main settings form.
Comment #5
levmyshkinBtw I will test your MR and merge it first tomorrow.
Comment #8
levmyshkinI merged your request and forked plyr library. It will download plyr library automatically with composer now. One I got error for getting paths with LibrariesDirectoryFileFinder, it returns 'library/plyr' path without slash at the beginning. It must be 'root' folder before, but there is no root prefix for my local site. I added '/' manually, which will be working for 99% of sites, but I think it will break base path for site in folder.
I released v1.0.12, ping me if you will have any problems with update. Since it was added a new argument in construction caches must be cleared after update.
Comment #9
levmyshkinI will test site in folder with /base_path/ root and add settings for Plyr in GLightbox settings form later.
Comment #10
levmyshkinComment #11
levmyshkinComment #12
levmyshkinDemo page is working fine after update:
https://drupalbook.org/ept/demo/video-and-image-gallery
Comment #13
pcambraThat was amazingly fast, many thanks levmyshkin!!!
The only issue we might have is upstream on the glightbox library: https://github.com/biati-digital/glightbox/blob/master/src/js/glightbox....
There's no way to configure two items that come directly from cdn on plyr: https://github.com/sampotts/plyr/blob/a148e2e5b6eb4cda1d63a21397636a365f...
One is a blank mp4 which loads conditionally but the other is the player button svg, and I can see people wanting to change that.
I was going to open an issue there but saw this message: https://github.com/biati-digital/glightbox/issues/472
Comment #14
levmyshkinHi pcambra, I added settings for plyr on GLightbox config form:
/admin/config/media/glightbox
I also forgot, that GLightbox has alter hook_glightbox_settings_alter(), where all settings are possible to change in custom module.
/modules/custom/glightbox/glightbox.api.php
Released the changes in 1.0.13 version.
Comment #15
pcambraYes, but I don't think the mp4 and the svg are configurable (see the links on #13)