j1-template 2024.3.24 → 2024.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/data/apps/amplitudehtml +1147 -0
- data/assets/data/apps/gallery.html +342 -0
- data/assets/data/{masonry.html → apps/masonry.html} +22 -9
- data/assets/data/apps/swiper.html +901 -0
- data/assets/data/masonry_app.html +521 -0
- data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.css +21 -13
- data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.min.css +1 -2
- data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +14 -13
- data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +1 -1
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +265 -226
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +1 -1
- data/assets/theme/j1/modules/videojs/css/themes/uno.css +12 -2
- data/assets/theme/j1/modules/videojs/css/videojs.css +2 -3
- data/assets/theme/j1/modules/videojs/css/videojs.min.css +1 -1
- data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.css +55 -55
- data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.min.css +2 -1
- data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.js +590 -382
- data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.min.js +1 -1
- data/assets/theme/j1/modules/videojs/plugins/j1_core/template.min.js +31 -0
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/{simple.html → index.html} +11 -10
- data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.0.js +647 -0
- data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.1.js +653 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{player → iframe_api}/index.html +3 -3
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{index.html → videojs_api/index.html} +7 -3
- data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.js +3562 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.min.js +36 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.js +451 -1849
- data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.min.js +2 -14
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/LICENSE +21 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/README.md +54 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.js +666 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.min.js +28 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.js +2318 -548
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.min.js +12 -18
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/{simple.html → index.html} +15 -6
- data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.js +12 -5
- data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.min.js +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/README.md +5 -5
- data/lib/starter_web/_config.yml +2 -2
- data/lib/starter_web/_data/blocks/banner.yml +1 -1
- data/lib/starter_web/_data/j1_config.yml +1 -1
- data/lib/starter_web/_data/layouts/home.yml +1 -1
- data/lib/starter_web/_data/modules/authentication.yml +1 -2
- data/lib/starter_web/_data/modules/defaults/masonry.yml +1 -1
- data/lib/starter_web/_data/modules/gallery.yml +35 -24
- data/lib/starter_web/_data/modules/log4javascript.yml +1 -1
- data/lib/starter_web/_data/modules/masonry.yml +30 -14
- data/lib/starter_web/_data/modules/navigator.yml +1 -1
- data/lib/starter_web/_data/modules/navigator_menu.yml +12 -8
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +206 -24
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/assets/image/module/attic/1920x1280/admin-dashboard-bootstrap.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-redl.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-shatov.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexey-ruban.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/andrea-badino.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/bootstrap-modal.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/bp-miller.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/brad-neathery.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/brigitta-schneiter.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/build-with-gemini.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/clem-onojeghuo.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/eleni-afiontzi.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/fly-d.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/guillaume-bolduc.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/ideas-start-here-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/isaac-davis.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-launch.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-mockup.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/john-schnobrich-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/josep-martins.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/josh-liu.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kelly-sikkemal.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kira-auf-der-heide.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kristopher-roller.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/markus-spiske.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/martin-sanchez.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/material_symbols.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/matthaeus.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/melanie-deziel.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/nasa.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/quino-al-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/stories-ink-tattoo-care.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/towfiqu-barbhuiya.jpg +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +2 -2
- data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +2 -2
- data/lib/starter_web/config.ru +1 -1
- data/lib/starter_web/dot.gitattributes +1 -1
- data/lib/starter_web/index.html +8 -8
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/about/features.adoc +5 -5
- data/lib/starter_web/pages/public/about/reporting_issues.adoc +5 -5
- data/lib/starter_web/pages/public/about/site.adoc +14 -10
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/000_intro.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
- data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_biography.adoc +1 -1
- data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_fantasy.adoc +1 -1
- data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_romance.adoc +1 -1
- data/lib/starter_web/pages/public/learn/bookshelf/jekyll_collections.adoc +1 -1
- data/lib/starter_web/pages/public/learn/bookshelf/viewer_all_books.adoc +1 -1
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +1 -1
- data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -3
- data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -3
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +3 -3
- data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +3 -3
- data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -4
- data/lib/starter_web/pages/public/plans/plans.adoc +1 -1
- data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +1 -1
- data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +116 -43
- data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +1 -1
- data/lib/starter_web/pages/public/tour/video_data.adoc +28 -22
- metadata +25 -49
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-controls.html +0 -18
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-javascript.html +0 -28
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-playlist.html +0 -19
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/global-parameters.html +0 -30
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/switch.html +0 -39
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/global-parameters.html +0 -34
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/switch.html +0 -39
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-controls.html +0 -20
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-javascript.html +0 -29
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-list.html +0 -21
- data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-playlist.html +0 -21
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-3.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-starter-mockup-1.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/admin-dashboard-bootstrap-1280x600.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/alice-donovan-rouse-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/building-blocks-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/christina-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/franck-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/giammarco-boscaro-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/jessica-ruscello-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/joanna-kosinska-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/leon-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/lianhao-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/library-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/markus-krisetya-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/markus-spiske-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/markus-spiske4-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/matthaeus-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/matthew-dockery-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/no-time-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/rirri-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/shubham-dhage-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/shutterstock_sponsor-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/sigmund-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/szabo-viktor-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/themes-1920x1280-bw.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/tldr-1920x800.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/vladislav-klapin-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/yellow-cactus-1920x1280.jpg +0 -0
- /data/assets/theme/j1/modules/videojs/plugins/players/vm/{LICENSE → js/old/LICENSE} +0 -0
- /data/assets/theme/j1/modules/videojs/plugins/players/vm/{README.md → js/old/README.md} +0 -0
@@ -27,7 +27,8 @@
|
|
27
27
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
28
28
|
typeof define === 'function' && define.amd ? define(factory) :
|
29
29
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lgVideo = factory());
|
30
|
-
}(this, (function () {
|
30
|
+
}(this, (function () {
|
31
|
+
'use strict';
|
31
32
|
|
32
33
|
/*! *****************************************************************************
|
33
34
|
Copyright (c) Microsoft Corporation.
|
@@ -105,6 +106,11 @@
|
|
105
106
|
autoplayStop: 'lgAutoplayStop',
|
106
107
|
};
|
107
108
|
|
109
|
+
|
110
|
+
var isEmpty = function (obj) {
|
111
|
+
return Object.keys(obj).length === 0;
|
112
|
+
};
|
113
|
+
|
108
114
|
var param = function (obj) {
|
109
115
|
return Object.keys(obj)
|
110
116
|
.map(function (k) {
|
@@ -218,7 +224,6 @@
|
|
218
224
|
|
219
225
|
}; // END loadVtt
|
220
226
|
|
221
|
-
|
222
227
|
// jadams
|
223
228
|
// -------------------------------------------------------------------------
|
224
229
|
// vjsProcessExtendedButtonsAndPlugins
|
@@ -227,259 +232,293 @@
|
|
227
232
|
// -------------------------------------------------------------------------
|
228
233
|
var vjsProcessExtendedButtonsAndPlugins = function (vjsObject, videojsPlayer, videoInfo) {
|
229
234
|
const vjsOptions = j1.modules.videojs.options;
|
230
|
-
var videoInfo, videoStart, videojsPlayer,
|
231
|
-
playbackRates, hotKeysPlugin, skipButtonsPlugin, zoomPlugin
|
235
|
+
var dependency_met_module_ready, videoInfo, videoStart, videojsPlayer,
|
236
|
+
playbackRates, hotKeysPlugin, skipButtonsPlugin, zoomPlugin,
|
237
|
+
trackSrc;
|
238
|
+
|
239
|
+
dependency_met_module_ready = setInterval (() => {
|
240
|
+
var isModuleInitialised = (j1.adapter.gallery.getState() === 'finished') ? true : false;
|
241
|
+
var isVideojsOptions = (isEmpty(vjsObject.settings.videojsOptions)) ? false : true;
|
242
|
+
|
243
|
+
if (isModuleInitialised && isVideojsOptions) {
|
244
|
+
var videoData = { tracks: false };
|
245
|
+
var playbackRatesDefaults = vjsOptions.playbackRates.values;
|
246
|
+
|
247
|
+
// disable chapterTracks by default
|
248
|
+
videojsPlayer.chapterTracksEnabled = false;
|
249
|
+
|
250
|
+
var hotKeysPluginDefaults = {
|
251
|
+
volumeStep: vjsOptions.plugins.hotKeys.volumeStep,
|
252
|
+
seekStep: vjsOptions.plugins.hotKeys.seekStep,
|
253
|
+
enableMute: vjsOptions.plugins.hotKeys.enableMute,
|
254
|
+
enableVolumeScroll: vjsOptions.plugins.hotKeys.enableVolumeScroll,
|
255
|
+
enableHoverScroll: vjsOptions.plugins.hotKeys.enableHoverScroll,
|
256
|
+
enableFullscreen: vjsOptions.plugins.hotKeys.enableFullscreen,
|
257
|
+
enableNumbers: vjsOptions.plugins.hotKeys.enableNumbers,
|
258
|
+
enableJogStyle: vjsOptions.plugins.hotKeys.enableJogStyle,
|
259
|
+
alwaysCaptureHotkeys: vjsOptions.plugins.hotKeys.alwaysCaptureHotkeys,
|
260
|
+
captureDocumentHotkeys: vjsOptions.plugins.hotKeys.captureDocumentHotkeys,
|
261
|
+
enableModifiersForNumbers: vjsOptions.plugins.hotKeys.enableModifiersForNumbers,
|
262
|
+
enableInactiveFocus: vjsOptions.plugins.hotKeys.enableInactiveFocus,
|
263
|
+
skipInitialFocus: vjsOptions.plugins.hotKeys.skipInitialFocus
|
264
|
+
};
|
232
265
|
|
233
|
-
|
234
|
-
|
235
|
-
|
266
|
+
var skipButtonsPluginDefaults = {
|
267
|
+
backward: vjsOptions.plugins.skipButtons.backward,
|
268
|
+
forward: vjsOptions.plugins.skipButtons.forward,
|
269
|
+
backwardIndex: 0,
|
270
|
+
forwardIndex: 1
|
271
|
+
};
|
236
272
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
enableMute: vjsOptions.plugins.hotKeys.enableMute,
|
244
|
-
enableVolumeScroll: vjsOptions.plugins.hotKeys.enableVolumeScroll,
|
245
|
-
enableHoverScroll: vjsOptions.plugins.hotKeys.enableHoverScroll,
|
246
|
-
enableFullscreen: vjsOptions.plugins.hotKeys.enableFullscreen,
|
247
|
-
enableNumbers: vjsOptions.plugins.hotKeys.enableNumbers,
|
248
|
-
enableJogStyle: vjsOptions.plugins.hotKeys.enableJogStyle,
|
249
|
-
alwaysCaptureHotkeys: vjsOptions.plugins.hotKeys.alwaysCaptureHotkeys,
|
250
|
-
captureDocumentHotkeys: vjsOptions.plugins.hotKeys.captureDocumentHotkeys,
|
251
|
-
enableModifiersForNumbers: vjsOptions.plugins.hotKeys.enableModifiersForNumbers,
|
252
|
-
enableInactiveFocus: vjsOptions.plugins.hotKeys.enableInactiveFocus,
|
253
|
-
skipInitialFocus: vjsOptions.plugins.hotKeys.skipInitialFocus
|
254
|
-
};
|
273
|
+
var zoomPluginDefaults = {
|
274
|
+
moveX: vjsOptions.plugins.zoomButtons.moveX,
|
275
|
+
moveY: vjsOptions.plugins.zoomButtons.moveY,
|
276
|
+
rotate: vjsOptions.plugins.zoomButtons.rotate,
|
277
|
+
zoom: vjsOptions.plugins.zoomButtons.zoom
|
278
|
+
};
|
255
279
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
backwardIndex: 0,
|
260
|
-
forwardIndex: 1
|
261
|
-
};
|
280
|
+
// jadams, 2025-06-11: added customControlContainer
|
281
|
+
// -------------------------------------------------------------
|
282
|
+
var vjsPlayerControlBar = videojsPlayer.controlBar;
|
262
283
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
284
|
+
// create customControlContainer for progressControlSilder|time (display) elements
|
285
|
+
const customProgressContainer = vjsPlayerControlBar.addChild('Component', {
|
286
|
+
el: videojs.dom.createEl('div', {
|
287
|
+
className: 'vjs-theme-uno custom-progressbar-container'
|
288
|
+
})
|
289
|
+
});
|
269
290
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
const customProgressContainer = vjsPlayerControlBar.addChild('Component', {
|
276
|
-
el: videojs.dom.createEl('div', {
|
277
|
-
className: 'vjs-theme-uno custom-progressbar-container'
|
278
|
-
})
|
279
|
-
});
|
280
|
-
|
281
|
-
// move progressControlSlider into customControlContainer
|
282
|
-
const progressControlSlider = vjsPlayerControlBar.progressControl;
|
283
|
-
if (progressControlSlider) {
|
284
|
-
customProgressContainer.el().appendChild(progressControlSlider.el());
|
285
|
-
}
|
291
|
+
// move progressControlSlider into customControlContainer
|
292
|
+
const progressControlSlider = vjsPlayerControlBar.progressControl;
|
293
|
+
if (progressControlSlider) {
|
294
|
+
customProgressContainer.el().appendChild(progressControlSlider.el());
|
295
|
+
}
|
286
296
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
297
|
+
// move currentTimeDisplay BEFORE the progressControlSilder
|
298
|
+
const currentTimeDisplay = vjsPlayerControlBar.currentTimeDisplay;
|
299
|
+
if (currentTimeDisplay) {
|
300
|
+
customProgressContainer.el().insertBefore(currentTimeDisplay.el(), progressControlSlider.el());
|
301
|
+
}
|
292
302
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
303
|
+
// move the durationDisplay AFTER the progressControlSilder
|
304
|
+
const durationDisplay = vjsPlayerControlBar.durationDisplay;
|
305
|
+
if (durationDisplay) {
|
306
|
+
customProgressContainer.el().appendChild(durationDisplay.el());
|
307
|
+
}
|
298
308
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
309
|
+
// configure VideoJS (extended) Plugins
|
310
|
+
// -------------------------------------------------------------
|
311
|
+
if (!isEmpty(vjsObject.settings.videojsOptions)) {
|
312
|
+
|
313
|
+
hotKeysPlugin = vjsObject.settings.videojsOptions.hotKeysPlugin;
|
314
|
+
skipButtonsPlugin = vjsObject.settings.videojsOptions.controlBar.skipButtonsPlugin;
|
315
|
+
zoomPlugin = vjsObject.settings.videojsOptions.controlBar.zoomPlugin;
|
316
|
+
playbackRates = vjsObject.settings.videojsOptions.controlBar.playbackRates;
|
317
|
+
|
318
|
+
// jadams, 2024-01-22: added video start position
|
319
|
+
// ---------------------------------------------------------
|
320
|
+
if (vjsObject.settings.videojsOptions.videoStart !== undefined) {
|
321
|
+
videoStart = vjsObject.settings.videojsOptions.videoStart[index];
|
322
|
+
videojsPlayer.on("play", function() {
|
323
|
+
var startFromSecond = new Date('1970-01-01T' + videoStart + 'Z').getTime() / 1000;
|
324
|
+
videojsPlayer.currentTime(startFromSecond);
|
325
|
+
}); // END on event play
|
326
|
+
} // END if videoStart
|
327
|
+
|
328
|
+
// add playbackRates, only available for VideoJS
|
329
|
+
// ---------------------------------------------------------
|
330
|
+
videojsPlayer.playbackRates(playbackRates);
|
331
|
+
|
332
|
+
// add hotkeys Plugin, only available for VideoJS
|
333
|
+
// ---------------------------------------------------------
|
334
|
+
if (hotKeysPlugin !== undefined && hotKeysPlugin.enabled && videojsPlayer.hotKeys !== undefined) {
|
335
|
+
|
336
|
+
// merge objects
|
337
|
+
hotKeysPlugin.options = __assign(__assign({}, hotKeysPluginDefaults), hotKeysPlugin.options);
|
338
|
+
|
339
|
+
// prevent multiple plugin instances
|
340
|
+
var hotKeysActive = false;
|
341
|
+
if (videojsPlayer.activePlugins_ !== undefined && videojsPlayer.activePlugins_.hotKeys !== undefined) {
|
342
|
+
hotKeysActive = videojsPlayer.activePlugins_.hotKeys;
|
343
|
+
}
|
305
344
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
345
|
+
if (!hotKeysActive) {
|
346
|
+
videojsPlayer.hotKeys({
|
347
|
+
volumeStep: hotKeysPlugin.options.volumeStep,
|
348
|
+
seekStep: hotKeysPlugin.options.seekStep,
|
349
|
+
enableMute: hotKeysPlugin.options.enableMute,
|
350
|
+
enableFullscreen: hotKeysPlugin.options.enableFullscreen,
|
351
|
+
enableNumbers: hotKeysPlugin.options.enableNumbers,
|
352
|
+
enableVolumeScroll: hotKeysPlugin.options.enableVolumeScroll,
|
353
|
+
enableHoverScroll: hotKeysPlugin.options.enableHoverScroll,
|
354
|
+
alwaysCaptureHotkeys: hotKeysPlugin.options.alwaysCaptureHotkeys,
|
355
|
+
captureDocumentHotkeys: hotKeysPlugin.options.captureDocumentHotkeys,
|
356
|
+
documentHotkeysFocusElementFilter: hotKeysPlugin.options.documentHotkeysFocusElementFilter,
|
357
|
+
|
358
|
+
// Mimic VLC seek behavior (default to: 15)
|
359
|
+
seekStep: function(e) {
|
360
|
+
if (e.ctrlKey && e.altKey) {
|
361
|
+
return 5*60;
|
362
|
+
} else if (e.ctrlKey) {
|
363
|
+
return 60;
|
364
|
+
} else if (e.altKey) {
|
365
|
+
return 10;
|
366
|
+
} else {
|
367
|
+
return 15;
|
368
|
+
}
|
369
|
+
}
|
321
370
|
|
322
|
-
|
323
|
-
|
324
|
-
if (hotKeysPlugin !== undefined && hotKeysPlugin.enabled && videojsPlayer.hotKeys !== undefined) {
|
371
|
+
});
|
372
|
+
} // END if hotKeysActive
|
325
373
|
|
326
|
-
|
327
|
-
hotKeysPlugin.options = __assign(__assign({}, hotKeysPluginDefaults), hotKeysPlugin.options);
|
374
|
+
} // END if hotKeysPlugin enabled
|
328
375
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
376
|
+
// add skipButtons Plugin, only available for VideoJS
|
377
|
+
// ---------------------------------------------------------
|
378
|
+
if (skipButtonsPlugin !== undefined && skipButtonsPlugin.enabled && videojsPlayer.skipButtons !== undefined) {
|
379
|
+
// merge objects
|
380
|
+
skipButtonsPlugin.options = __assign(__assign({}, skipButtonsPluginDefaults), skipButtonsPlugin.options);
|
334
381
|
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
enableMute: hotKeysPlugin.options.enableMute,
|
340
|
-
enableFullscreen: hotKeysPlugin.options.enableFullscreen,
|
341
|
-
enableNumbers: hotKeysPlugin.options.enableNumbers,
|
342
|
-
enableVolumeScroll: hotKeysPlugin.options.enableVolumeScroll,
|
343
|
-
enableHoverScroll: hotKeysPlugin.options.enableHoverScroll,
|
344
|
-
alwaysCaptureHotkeys: hotKeysPlugin.options.alwaysCaptureHotkeys,
|
345
|
-
captureDocumentHotkeys: hotKeysPlugin.options.captureDocumentHotkeys,
|
346
|
-
documentHotkeysFocusElementFilter: hotKeysPlugin.options.documentHotkeysFocusElementFilter,
|
347
|
-
|
348
|
-
// Mimic VLC seek behavior (default to: 15)
|
349
|
-
seekStep: function(e) {
|
350
|
-
if (e.ctrlKey && e.altKey) {
|
351
|
-
return 5*60;
|
352
|
-
} else if (e.ctrlKey) {
|
353
|
-
return 60;
|
354
|
-
} else if (e.altKey) {
|
355
|
-
return 10;
|
356
|
-
} else {
|
357
|
-
return 15;
|
382
|
+
// prevent multiple plugin instances
|
383
|
+
var skipButtonsActive = false;
|
384
|
+
if (videojsPlayer.activePlugins_ !== undefined && videojsPlayer.activePlugins_.skipButtons !== undefined) {
|
385
|
+
skipButtonsActive = videojsPlayer.activePlugins_.skipButtons;
|
358
386
|
}
|
359
|
-
}
|
360
387
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
// merge objects
|
370
|
-
skipButtonsPlugin.options = __assign(__assign({}, skipButtonsPluginDefaults), skipButtonsPlugin.options);
|
371
|
-
|
372
|
-
// prevent multiple plugin instances
|
373
|
-
var skipButtonsActive = false;
|
374
|
-
if (videojsPlayer.activePlugins_ !== undefined && videojsPlayer.activePlugins_.skipButtons !== undefined) {
|
375
|
-
skipButtonsActive = videojsPlayer.activePlugins_.skipButtons;
|
376
|
-
}
|
377
|
-
|
378
|
-
if (!skipButtonsActive) {
|
379
|
-
videojsPlayer.skipButtons({
|
380
|
-
backward: skipButtonsPlugin.options.backward,
|
381
|
-
forward: skipButtonsPlugin.options.forward,
|
382
|
-
backwardIndex: skipButtonsPlugin.options.backwardIndex,
|
383
|
-
forwardIndex: skipButtonsPlugin.options.forwardIndex
|
384
|
-
});
|
385
|
-
}
|
388
|
+
if (!skipButtonsActive) {
|
389
|
+
videojsPlayer.skipButtons({
|
390
|
+
backward: skipButtonsPlugin.options.backward,
|
391
|
+
forward: skipButtonsPlugin.options.forward,
|
392
|
+
backwardIndex: skipButtonsPlugin.options.backwardIndex,
|
393
|
+
forwardIndex: skipButtonsPlugin.options.forwardIndex
|
394
|
+
});
|
395
|
+
}
|
386
396
|
|
387
|
-
|
397
|
+
} // END if skipButtons Plugin enabled
|
388
398
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
399
|
+
// add zoom Plugin (only available for VJS|local video/mp4)
|
400
|
+
// ---------------------------------------------------------
|
401
|
+
if (videoInfo.youtube) {
|
402
|
+
// zoom pluging NOT supported for YouTube
|
403
|
+
zoomPlugin.enabled = false;
|
404
|
+
}
|
395
405
|
|
396
|
-
|
397
|
-
|
398
|
-
|
406
|
+
if (zoomPlugin !== undefined && zoomPlugin.enabled && videojsPlayer.zoomButtons !== undefined) {
|
407
|
+
// merge objects
|
408
|
+
zoomPlugin.options = __assign(__assign({}, zoomPluginDefaults), zoomPlugin.options);
|
399
409
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
410
|
+
// prevent multiple plugin instances
|
411
|
+
var zoomButtonsActive = false;
|
412
|
+
if (videojsPlayer.activePlugins_ !== undefined && videojsPlayer.activePlugins_.zoomButtons !== undefined) {
|
413
|
+
zoomButtonsActive = videojsPlayer.activePlugins_.zoomButtons;
|
414
|
+
}
|
415
|
+
|
416
|
+
if (!zoomButtonsActive) {
|
417
|
+
videojsPlayer.zoomButtons({
|
418
|
+
moveX: zoomPlugin.options.moveX,
|
419
|
+
moveY: zoomPlugin.options.moveY,
|
420
|
+
rotate: zoomPlugin.options.rotate,
|
421
|
+
zoom: zoomPlugin.options.zoom
|
422
|
+
});
|
423
|
+
}
|
414
424
|
|
415
|
-
|
425
|
+
} // END if zoom Plugin enabled
|
416
426
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
427
|
+
// chapter tracks only available for VideoJS (local video/mp4)
|
428
|
+
// ---------------------------------------------------------
|
429
|
+
if (vjsObject.core.galleryItems[vjsObject.core.index].video !== undefined) {
|
430
|
+
videoData = JSON.parse(vjsObject.core.galleryItems[vjsObject.core.index].video);
|
431
|
+
}
|
422
432
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
+
// load tracks
|
434
|
+
// TODO: chapterTracksEnabled needs to be indivialized
|
435
|
+
// per player
|
436
|
+
// ---------------------------------------------------------
|
437
|
+
if (videoData.tracks && videoData.tracks.length > 0) {
|
438
|
+
for (var i=0; i<videoData.tracks.length; i++) {
|
439
|
+
if (videoData.tracks[i].kind == 'chapters') {
|
440
|
+
trackSrc = videoData.tracks[i].src;
|
441
|
+
videojsPlayer.chapterTracksEnabled = true;
|
442
|
+
}
|
443
|
+
}
|
444
|
+
} // END load tracks
|
445
|
+
|
446
|
+
// process (chapter) tracks if tracks available
|
447
|
+
// ---------------------------------------------------------
|
448
|
+
if (videojsPlayer.chapterTracksEnabled) {
|
449
|
+
var parser = new WebVTTParser();
|
450
|
+
var markers = [];
|
451
|
+
|
452
|
+
function cb_load (data /* ,textStatus, jqXHR */ ) {
|
453
|
+
var tree = parser.parse(data, 'metadata');
|
454
|
+
var marker;
|
455
|
+
|
456
|
+
// add chapter tracks to markers array
|
457
|
+
for (var i=0; i<tree.cues.length; i++) {
|
458
|
+
marker = { time: tree.cues[i].startTime, label: tree.cues[i].text };
|
459
|
+
markers.push(marker);
|
460
|
+
}
|
461
|
+
}; // END function cb_load
|
462
|
+
|
463
|
+
// load chapter tracks
|
464
|
+
// -----------------------------------------------------
|
465
|
+
loadVtt(trackSrc, cb_load);
|
466
|
+
|
467
|
+
// add chapter tracks on player is playing
|
468
|
+
// -----------------------------------------------------
|
469
|
+
videojsPlayer.on("play", function() {
|
470
|
+
videojsPlayer.currentTime(videoStart);
|
471
|
+
|
472
|
+
var total = videojsPlayer.duration();
|
473
|
+
var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
|
474
|
+
|
475
|
+
// remove old|previous markers
|
476
|
+
timeline.find('.vjs-chapter-marker').remove();
|
477
|
+
|
478
|
+
// add chapter tracks on timeline (delayed)
|
479
|
+
setTimeout (function() {
|
480
|
+
var markers_loaded = setInterval (function () {
|
481
|
+
if (markers.length) {
|
482
|
+
// make sure, that previous markers deleted
|
483
|
+
timeline.find('.vjs-chapter-marker').remove();
|
484
|
+
|
485
|
+
for (var i=0; i<markers.length; i++) {
|
486
|
+
var left = (markers[i].time / total * 100) + '%';
|
487
|
+
var time = markers[i].time;
|
488
|
+
var el = $('<div class="vjs-chapter-marker" style="left: ' +left+ '" data-time="' +time+ '"> <span>' +markers[i].label+ '</span></div>');
|
489
|
+
|
490
|
+
el.click(function() {
|
491
|
+
videojsPlayer.currentTime($(this).data('time'));
|
492
|
+
});
|
493
|
+
|
494
|
+
timeline.append(el);
|
495
|
+
}
|
496
|
+
clearInterval(markers_loaded);
|
497
|
+
}
|
498
|
+
}, 10); // END markers_loaded
|
499
|
+
}, 100 ); // END setTimeout
|
433
500
|
|
434
|
-
|
435
|
-
|
436
|
-
|
501
|
+
});
|
502
|
+
} else {
|
503
|
+
// remove chapter tracks on playing
|
504
|
+
// -----------------------------------------------------
|
505
|
+
videojsPlayer.on("play", function() {
|
506
|
+
videojsPlayer.chapterTracksEnabled = false;
|
507
|
+
var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
|
437
508
|
|
438
|
-
|
439
|
-
|
440
|
-
var marker;
|
509
|
+
// remove existing markers
|
510
|
+
timeline.find('.vjs-chapter-marker').remove();
|
441
511
|
|
442
|
-
|
443
|
-
for (var i=0; i<tree.cues.length; i++) {
|
444
|
-
marker = { time: tree.cues[i].startTime, label: tree.cues[i].text };
|
445
|
-
markers.push(marker);
|
446
|
-
}
|
447
|
-
}; // END function cb_load
|
512
|
+
});
|
448
513
|
|
449
|
-
|
450
|
-
// -----------------------------------------------------------------
|
451
|
-
loadVtt(trackSrc, cb_load);
|
452
|
-
|
453
|
-
// add chapter tracks on play
|
454
|
-
videojsPlayer.on("play", function() {
|
455
|
-
videojsPlayer.currentTime(videoStart);
|
456
|
-
|
457
|
-
var total = videojsPlayer.duration();
|
458
|
-
var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
|
459
|
-
|
460
|
-
// add chapter tracks on timeline (delayed)
|
461
|
-
setTimeout (function() {
|
462
|
-
var markers_loaded = setInterval (function () {
|
463
|
-
if (markers.length) {
|
464
|
-
for (var i=0; i<markers.length; i++) {
|
465
|
-
var left = (markers[i].time / total * 100) + '%';
|
466
|
-
var time = markers[i].time;
|
467
|
-
var el = $('<div class="vjs-chapter-marker" style="left: ' +left+ '" data-time="' +time+ '"> <span>' +markers[i].label+ '</span></div>');
|
468
|
-
|
469
|
-
el.click(function() {
|
470
|
-
videojsPlayer.currentTime($(this).data('time'));
|
471
|
-
});
|
514
|
+
} // END remove chapter tracks
|
472
515
|
|
473
|
-
|
474
|
-
}
|
475
|
-
clearInterval(markers_loaded);
|
476
|
-
}
|
477
|
-
}, 10); // END markers_loaded
|
478
|
-
}, 1000 ); // END setTimeout
|
516
|
+
} // END if videojsOptions
|
479
517
|
|
480
|
-
|
518
|
+
clearInterval(dependency_met_module_ready);
|
519
|
+
} // END if isModuleInitialised
|
481
520
|
|
482
|
-
|
521
|
+
}, 10); // END dependency_met_page_ready
|
483
522
|
|
484
523
|
}; // END vjsProcessExtendedButtonsAndPlugins
|
485
524
|
|
@@ -16,4 +16,4 @@
|
|
16
16
|
# -----------------------------------------------------------------------------
|
17
17
|
*/
|
18
18
|
|
19
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).lgVideo=o()}(this,(function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var o,t=1,i=arguments.length;t<i;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},e.apply(this,arguments)},o={autoplayFirstVideo:!0,htmlPlayerParams:!1,youTubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,wistiaPlayerParams:!1,tiktokPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},t="lgHasVideo",i="lgSlideItemLoad",s="lgBeforeSlide",n="lgAfterSlide",l="lgPosterClick",a=function(e){return Object.keys(e).map((function(o){return encodeURIComponent(o)+"="+encodeURIComponent(e[o])})).join("&")},r=function(o,t){if(!o.youtube)return"";var i=o.youtube[2]?o.youtube[2].slice(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,o){var t=o.map(decodeURIComponent),i=t[0],s=t[1];return e[i]=s,e}),{}):"",s=t||{},n=e(e(e({},{wmode:"opaque",autoplay:0,mute:1,enablejsapi:1}),s),i);return"?"+a(n)},d=function(o,t,i){const s=j1.modules.videojs.options;var n,l,a,r,d,c={tracks:!1},u=s.playbackRates.values,p=!1,v={volumeStep:s.plugins.hotKeys.volumeStep,seekStep:s.plugins.hotKeys.seekStep,enableMute:s.plugins.hotKeys.enableMute,enableVolumeScroll:s.plugins.hotKeys.enableVolumeScroll,enableHoverScroll:s.plugins.hotKeys.enableHoverScroll,enableFullscreen:s.plugins.hotKeys.enableFullscreen,enableNumbers:s.plugins.hotKeys.enableNumbers,enableJogStyle:s.plugins.hotKeys.enableJogStyle,alwaysCaptureHotkeys:s.plugins.hotKeys.alwaysCaptureHotkeys,captureDocumentHotkeys:s.plugins.hotKeys.captureDocumentHotkeys,enableModifiersForNumbers:s.plugins.hotKeys.enableModifiersForNumbers,enableInactiveFocus:s.plugins.hotKeys.enableInactiveFocus,skipInitialFocus:s.plugins.hotKeys.skipInitialFocus},m={backward:s.plugins.skipButtons.backward,forward:s.plugins.skipButtons.forward,backwardIndex:0,forwardIndex:1},y={moveX:s.plugins.zoomButtons.moveX,moveY:s.plugins.zoomButtons.moveY,rotate:s.plugins.zoomButtons.rotate,zoom:s.plugins.zoomButtons.zoom},h=t.controlBar;const g=h.addChild("Component",{el:videojs.dom.createEl("div",{className:"vjs-theme-uno custom-progressbar-container"})}),f=h.progressControl;f&&g.el().appendChild(f.el());const b=h.currentTimeDisplay;b&&g.el().insertBefore(b.el(),f.el());const w=h.durationDisplay;if(w&&g.el().appendChild(w.el()),a=void 0!==o.settings.videojsOptions.hotKeysPlugin?o.settings.videojsOptions.hotKeysPlugin:v,r=void 0!==o.settings.videojsOptions.controlBar.skipButtonsPlugin?o.settings.videojsOptions.controlBar.skipButtonsPlugin:m,d=void 0!==o.settings.videojsOptions.controlBar.zoomPlugin&&o.settings.videojsOptions.controlBar.zoomPlugin,l=void 0!==o.settings.videojsOptions.controlBar.playbackRates?o.settings.videojsOptions.controlBar.playbackRates:u,void 0!==o.settings.videojsOptions.videoStart&&(n=o.settings.videojsOptions.videoStart[index],t.on("play",(function(){var e=new Date("1970-01-01T"+n+"Z").getTime()/1e3;t.currentTime(e)}))),void 0!==t.playbackRates&&t.playbackRates(l),void 0!==a&&a.enabled&&void 0!==t.hotKeys){a.options=e(e({},v),a.options);var k=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.hotKeys&&(k=t.activePlugins_.hotKeys),k||t.hotKeys({volumeStep:a.options.volumeStep,seekStep:a.options.seekStep,enableMute:a.options.enableMute,enableFullscreen:a.options.enableFullscreen,enableNumbers:a.options.enableNumbers,enableVolumeScroll:a.options.enableVolumeScroll,enableHoverScroll:a.options.enableHoverScroll,alwaysCaptureHotkeys:a.options.alwaysCaptureHotkeys,captureDocumentHotkeys:a.options.captureDocumentHotkeys,documentHotkeysFocusElementFilter:a.options.documentHotkeysFocusElementFilter,seekStep:function(e){return e.ctrlKey&&e.altKey?300:e.ctrlKey?60:e.altKey?10:15}})}if(void 0!==r&&r.enabled&&void 0!==t.skipButtons){r.options=e(e({},m),r.options);var j=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.skipButtons&&(j=t.activePlugins_.skipButtons),j||t.skipButtons({backward:r.options.backward,forward:r.options.forward,backwardIndex:r.options.backwardIndex,forwardIndex:r.options.forwardIndex})}if(i.youtube&&(d.enabled=!1),void 0!==d&&d.enabled&&void 0!==t.zoomButtons){d.options=e(e({},y),d.options);var V=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.zoomButtons&&(V=t.activePlugins_.zoomButtons),V||t.zoomButtons({moveX:d.options.moveX,moveY:d.options.moveY,rotate:d.options.rotate,zoom:d.options.zoom})}if(void 0!==o.core.galleryItems[o.core.index].video&&(c=JSON.parse(o.core.galleryItems[o.core.index].video)),c.tracks&&c.tracks.length>0)for(var P=0;P<c.tracks.length;P++)"chapters"==c.tracks[P].kind&&(trackSrc=c.tracks[P].src,p=!0);if(p){var S=new WebVTTParser,x=[];function _(e){for(var o,t=S.parse(e,"metadata"),i=0;i<t.cues.length;i++)o={time:t.cues[i].startTime,label:t.cues[i].text},x.push(o)}I=trackSrc,O=_,new WebVTTParser,$.ajax({url:I,type:"GET",success:O,error:function(e){JSON.stringify(e,void 0,2)}}),t.on("play",(function(){t.currentTime(n);var e=t.duration(),o=$(t.controlBar.progressControl.children_[0].el_);setTimeout((function(){var i=setInterval((function(){if(x.length){for(var s=0;s<x.length;s++){var n=x[s].time/e*100+"%",l=x[s].time,a=$('<div class="vjs-chapter-marker" style="left: '+n+'" data-time="'+l+'"> <span>'+x[s].label+"</span></div>");a.click((function(){t.currentTime($(this).data("time"))})),o.append(a)}clearInterval(i)}}),10)}),1e3)}))}var I,O};return function(){function c(t){return this.core=t,this.settings=e(e({},o),this.core.settings),this}return c.prototype.init=function(){var e=this;this.core.LGel.on(t+".video",this.onHasVideo.bind(this)),this.core.LGel.on(l+".video",(function(){var o=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(o)})),this.core.LGel.on(i+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(s+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(n+".video",this.onAfterSlide.bind(this))},c.prototype.onSlideItemLoad=function(e){var o=this,t=e.detail,i=t.isFirstSlide,s=t.index;this.settings.autoplayFirstVideo&&i&&s===this.core.index&&setTimeout((function(){o.loadAndPlayVideo(s)}),200),!i&&this.settings.autoplayVideoOnSlide&&s===this.core.index&&this.loadAndPlayVideo(s)},c.prototype.onHasVideo=function(e){var o=e.detail,t=o.index,i=o.src,s=o.html5Video;o.hasPoster||(this.appendVideo(this.core.getSlideItem(t),{src:i,addClass:"lg-object",index:t,html5Video:s}),this.gotoNextSlideOnVideoEnd(i,t))},c.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var o=e.detail.prevIndex;this.pauseVideo(o)}},c.prototype.onAfterSlide=function(e){var o=this,t=e.detail,i=t.index,s=t.prevIndex,n=this.core.getSlideItem(i);this.settings.autoplayVideoOnSlide&&i!==s&&n.hasClass("lg-complete")&&setTimeout((function(){o.loadAndPlayVideo(i)}),100)},c.prototype.loadAndPlayVideo=function(e){var o=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(o,!0):this.playVideo(e)},c.prototype.playVideo=function(e){this.controlVideo(e,"play")},c.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},c.prototype.getVideoHtml=function(e,o,t,i){var s,n,l,d,c;if(n=this.core.galleryItems[t].__slideVideoInfo||{},(s=this.core.galleryItems[t]).subHtml.includes("<h2>")?l=s.subHtml.split("</h2>")[0].replace("<h2>",""):s.subHtml.includes("<h5>")&&(l=s.subHtml.split("</h5>")[0].replace("<h5>","")),l=l?'title="'+l+'"':"",c='allowtransparency="true"\n frameborder="0"\n scrolling="no"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n oallowfullscreen\n msallowfullscreen',n.youtube){var u="lg-youtube"+t,p=(r(n,this.settings.youTubePlayerParams),e.includes("youtube-nocookie.com"),n.youtube[1]);"youtube",d=`\n <video\n id="${u}"\n class="video-js lg-video-object lg-youtube vjs-theme-uno">\n <source\n type="video/youtube",\n src="//youtube.com/watch?v=${p}"\n >\n\n Your browser does not support HTML5 video.\n </video>\n `}else if(n.vimeo){u="lg-vimeo"+t;var v=function(e,o){if(!o||!o.vimeo)return"";var t=o.vimeo[2]||"",i=Object.assign({},{autoplay:0,muted:1},e),s=i&&0!==Object.keys(i).length?a(i):"",n=((o.vimeo[0].split("/").pop()||"").split("?")[0]||"").split("#")[0],l=o.vimeo[1]!==n;l&&(t=t.replace("/"+n,""));var r=l?"h="+n:"";return"?"+r+(s=r?"&"+s:s)+("?"==t[0]?"&"+t.slice(1):t||"")}(this.settings.vimeoPlayerParams,n);d='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+o+'" '+l+' src="//player.vimeo.com/video/'+(n.vimeo[1]+v)+'" '+c+"></iframe>"}else if(n.wistia){var m="lg-wistia"+t;v=(v=a(this.settings.wistiaPlayerParams))?"?"+v:"",d='<iframe allow="autoplay" id="'+m+'" src="//fast.wistia.net/embed/iframe/'+(n.wistia[4]+v)+'" '+l+' class="wistia_embed lg-video-object lg-wistia '+o+'" name="wistia_embed" '+c+"></iframe>"}else if(n.dailymotion){var y="lg-dailymotion"+t;v=(v=a(this.settings.dailymotionPlayerParams))?"?"+v:"",d=`\n <iframe\n id="${y}"\n src="//dailymotion.com/embed/video/${n.dailymotion[1]}?api=1 ${v}"\n ${l}\n class="dailymotion_embed lg-video-object lg-dailymotiion ${o}"\n name="dailymotion_embed"\n ${c}>\n </iframe>\n `}else if(n.html5){for(var h="",g=0;g<i.source.length;g++){var f=i.source[g].type,b=f?'type="'+f+'"':"";h+='<source src="'+i.source[g].src+'" '+b+">"}if(i.tracks){var w=function(e){var o="",t=i.tracks[e];Object.keys(t||{}).forEach((function(e){o+=e+'="'+t[e]+'" '})),h+="<track "+o+">"};for(g=0;g<i.tracks.length;g++)w(g)}var k="",j=i.attributes||{};Object.keys(j||{}).forEach((function(e){k+=e+'="'+j[e]+'" '})),d='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+k+">\n "+h+"\n Your browser does not support HTML5 video.\n </video>"}return d},c.prototype.appendVideo=function(e,o){var t,i,s={},n=this.getVideoHtml(o.src,o.addClass,o.index,o.html5Video);e.find(".lg-video-cont").append(n);var l=e.find(".lg-video-object").first();if(l.get()){if(o.html5Video&&l.on("mousedown.lg.video",(function(e){e.stopPropagation()})),(s=this.core.galleryItems[o.index].__slideVideoInfo).videojs={enabled:!1},i=n.includes("iframe"),s.videojs.enabled=!i,this.settings.videojs&&(null==s?void 0:s.html5))try{if(s.videojs.enabled)return t=videojs(l.get(),this.settings.videojsOptions),this.settings.vjsPlayer=t,s.videojs.player=t,t}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}if(this.settings.videojs&&(null==s?void 0:s.youtube))try{if(s.videojs.enabled)return t=videojs(l.get(),this.settings.videojsOptions),this.settings.vjsPlayer=t,s.videojs.player=t,t}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}}},c.prototype.gotoNextSlideOnVideoEnd=function(e,o){var t=this,i=this.core.getSlideItem(o).find(".lg-video-object").first();if(i.get()){var s=this.core.galleryItems[o].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd)if(s.html5)i.on("ended",(function(){t.core.goToNextSlide()}));else if(s.vimeo)try{new Vimeo.Player(i.get()).on("ended",(function(){t.core.goToNextSlide()}))}catch(e){console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(s.wistia)try{window._wq=window._wq||[],window._wq.push({id:i.attr("id"),onReady:function(e){e.bind("end",(function(){t.core.goToNextSlide()}))}})}catch(e){console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}}},c.prototype.controlVideo=function(e,o){var t,i,s="not_set";if((t=this.core.getSlideItem(e).find(".lg-video-object").first()).get())if(((i=this.core.galleryItems[e].__slideVideoInfo||{}).html5||i.youtube)&&(void 0!==t.selector.player&&(s=t.selector.player),"not_set"!==s&&d(this,s,i)),i.html5)if(this.settings.videojs)try{videojs(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included videojs")}else t.get()[o]();else if(i.youtube)if(this.settings.videojs)try{videojs(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included videojs")}else try{t.get().contentWindow.postMessage('{"event":"command","func":"'+o+'Video","args":""}',"*")}catch(e){console.error("lightGallery:- "+e)}else if(i.vimeo)try{new Vimeo.Player(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(i.wistia)try{window._wq=window._wq||[],window._wq.push({id:t.attr("id"),onReady:function(e){e[o]()}})}catch(e){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},c.prototype.loadVideoOnPosterClick=function(e,o){var t=this;if(e.hasClass("lg-video-loaded"))o&&this.playVideo(this.core.index);else if(e.hasClass("lg-has-video"))this.playVideo(this.core.index);else{e.addClass("lg-has-video");var i=void 0,s=this.core.galleryItems[this.core.index].src,n=this.core.galleryItems[this.core.index].video;n&&(i="string"==typeof n?JSON.parse(n):n);var l=this.appendVideo(e,{src:s,addClass:"",index:this.core.index,html5Video:i});this.gotoNextSlideOnVideoEnd(s,this.core.index);var a=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(a),e.addClass("lg-video-loading"),l&&l.ready((function(){l.on("loadedmetadata",(function(){t.onVideoLoadAfterPosterClick(e,t.core.index)}))})),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",(function(){setTimeout((function(){t.onVideoLoadAfterPosterClick(e,t.core.index)}),50)}))}},c.prototype.onVideoLoadAfterPosterClick=function(e,o){e.addClass("lg-video-loaded"),this.playVideo(o)},c.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},c}()}));
|
19
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).lgVideo=o()}(this,(function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var o,t=1,i=arguments.length;t<i;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},e.apply(this,arguments)},o={autoplayFirstVideo:!0,htmlPlayerParams:!1,youTubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,wistiaPlayerParams:!1,tiktokPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},t="lgHasVideo",i="lgSlideItemLoad",s="lgBeforeSlide",n="lgAfterSlide",l="lgPosterClick",a=function(e){return 0===Object.keys(e).length},r=function(e){return Object.keys(e).map((function(o){return encodeURIComponent(o)+"="+encodeURIComponent(e[o])})).join("&")},d=function(o,t){if(!o.youtube)return"";var i=o.youtube[2]?o.youtube[2].slice(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,o){var t=o.map(decodeURIComponent),i=t[0],s=t[1];return e[i]=s,e}),{}):"",s=t||{},n=e(e(e({},{wmode:"opaque",autoplay:0,mute:1,enablejsapi:1}),s),i);return"?"+r(n)},c=function(o,t,i){const s=j1.modules.videojs.options;var n,l,r,d,c,u,p;n=setInterval((()=>{var v,m,h="finished"===j1.adapter.gallery.getState(),y=!a(o.settings.videojsOptions);if(h&&y){var g={tracks:!1};s.playbackRates.values;t.chapterTracksEnabled=!1;var f={volumeStep:s.plugins.hotKeys.volumeStep,seekStep:s.plugins.hotKeys.seekStep,enableMute:s.plugins.hotKeys.enableMute,enableVolumeScroll:s.plugins.hotKeys.enableVolumeScroll,enableHoverScroll:s.plugins.hotKeys.enableHoverScroll,enableFullscreen:s.plugins.hotKeys.enableFullscreen,enableNumbers:s.plugins.hotKeys.enableNumbers,enableJogStyle:s.plugins.hotKeys.enableJogStyle,alwaysCaptureHotkeys:s.plugins.hotKeys.alwaysCaptureHotkeys,captureDocumentHotkeys:s.plugins.hotKeys.captureDocumentHotkeys,enableModifiersForNumbers:s.plugins.hotKeys.enableModifiersForNumbers,enableInactiveFocus:s.plugins.hotKeys.enableInactiveFocus,skipInitialFocus:s.plugins.hotKeys.skipInitialFocus},b={backward:s.plugins.skipButtons.backward,forward:s.plugins.skipButtons.forward,backwardIndex:0,forwardIndex:1},k={moveX:s.plugins.zoomButtons.moveX,moveY:s.plugins.zoomButtons.moveY,rotate:s.plugins.zoomButtons.rotate,zoom:s.plugins.zoomButtons.zoom},j=t.controlBar;const O=j.addChild("Component",{el:videojs.dom.createEl("div",{className:"vjs-theme-uno custom-progressbar-container"})}),_=j.progressControl;_&&O.el().appendChild(_.el());const T=j.currentTimeDisplay;T&&O.el().insertBefore(T.el(),_.el());const C=j.durationDisplay;if(C&&O.el().appendChild(C.el()),!a(o.settings.videojsOptions)){if(d=o.settings.videojsOptions.hotKeysPlugin,c=o.settings.videojsOptions.controlBar.skipButtonsPlugin,u=o.settings.videojsOptions.controlBar.zoomPlugin,r=o.settings.videojsOptions.controlBar.playbackRates,void 0!==o.settings.videojsOptions.videoStart&&(l=o.settings.videojsOptions.videoStart[index],t.on("play",(function(){var e=new Date("1970-01-01T"+l+"Z").getTime()/1e3;t.currentTime(e)}))),t.playbackRates(r),void 0!==d&&d.enabled&&void 0!==t.hotKeys){d.options=e(e({},f),d.options);var w=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.hotKeys&&(w=t.activePlugins_.hotKeys),w||t.hotKeys({volumeStep:d.options.volumeStep,seekStep:d.options.seekStep,enableMute:d.options.enableMute,enableFullscreen:d.options.enableFullscreen,enableNumbers:d.options.enableNumbers,enableVolumeScroll:d.options.enableVolumeScroll,enableHoverScroll:d.options.enableHoverScroll,alwaysCaptureHotkeys:d.options.alwaysCaptureHotkeys,captureDocumentHotkeys:d.options.captureDocumentHotkeys,documentHotkeysFocusElementFilter:d.options.documentHotkeysFocusElementFilter,seekStep:function(e){return e.ctrlKey&&e.altKey?300:e.ctrlKey?60:e.altKey?10:15}})}if(void 0!==c&&c.enabled&&void 0!==t.skipButtons){c.options=e(e({},b),c.options);var V=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.skipButtons&&(V=t.activePlugins_.skipButtons),V||t.skipButtons({backward:c.options.backward,forward:c.options.forward,backwardIndex:c.options.backwardIndex,forwardIndex:c.options.forwardIndex})}if(i.youtube&&(u.enabled=!1),void 0!==u&&u.enabled&&void 0!==t.zoomButtons){u.options=e(e({},k),u.options);var P=!1;void 0!==t.activePlugins_&&void 0!==t.activePlugins_.zoomButtons&&(P=t.activePlugins_.zoomButtons),P||t.zoomButtons({moveX:u.options.moveX,moveY:u.options.moveY,rotate:u.options.rotate,zoom:u.options.zoom})}if(void 0!==o.core.galleryItems[o.core.index].video&&(g=JSON.parse(o.core.galleryItems[o.core.index].video)),g.tracks&&g.tracks.length>0)for(var S=0;S<g.tracks.length;S++)"chapters"==g.tracks[S].kind&&(p=g.tracks[S].src,t.chapterTracksEnabled=!0);if(t.chapterTracksEnabled){var x=new WebVTTParser,I=[];function B(e){for(var o,t=x.parse(e,"metadata"),i=0;i<t.cues.length;i++)o={time:t.cues[i].startTime,label:t.cues[i].text},I.push(o)}v=p,m=B,new WebVTTParser,$.ajax({url:v,type:"GET",success:m,error:function(e){JSON.stringify(e,void 0,2)}}),t.on("play",(function(){t.currentTime(l);var e=t.duration(),o=$(t.controlBar.progressControl.children_[0].el_);o.find(".vjs-chapter-marker").remove(),setTimeout((function(){var i=setInterval((function(){if(I.length){o.find(".vjs-chapter-marker").remove();for(var s=0;s<I.length;s++){var n=I[s].time/e*100+"%",l=I[s].time,a=$('<div class="vjs-chapter-marker" style="left: '+n+'" data-time="'+l+'"> <span>'+I[s].label+"</span></div>");a.click((function(){t.currentTime($(this).data("time"))})),o.append(a)}clearInterval(i)}}),10)}),100)}))}else t.on("play",(function(){t.chapterTracksEnabled=!1,$(t.controlBar.progressControl.children_[0].el_).find(".vjs-chapter-marker").remove()}))}clearInterval(n)}}),10)};return function(){function a(t){return this.core=t,this.settings=e(e({},o),this.core.settings),this}return a.prototype.init=function(){var e=this;this.core.LGel.on(t+".video",this.onHasVideo.bind(this)),this.core.LGel.on(l+".video",(function(){var o=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(o)})),this.core.LGel.on(i+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(s+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(n+".video",this.onAfterSlide.bind(this))},a.prototype.onSlideItemLoad=function(e){var o=this,t=e.detail,i=t.isFirstSlide,s=t.index;this.settings.autoplayFirstVideo&&i&&s===this.core.index&&setTimeout((function(){o.loadAndPlayVideo(s)}),200),!i&&this.settings.autoplayVideoOnSlide&&s===this.core.index&&this.loadAndPlayVideo(s)},a.prototype.onHasVideo=function(e){var o=e.detail,t=o.index,i=o.src,s=o.html5Video;o.hasPoster||(this.appendVideo(this.core.getSlideItem(t),{src:i,addClass:"lg-object",index:t,html5Video:s}),this.gotoNextSlideOnVideoEnd(i,t))},a.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var o=e.detail.prevIndex;this.pauseVideo(o)}},a.prototype.onAfterSlide=function(e){var o=this,t=e.detail,i=t.index,s=t.prevIndex,n=this.core.getSlideItem(i);this.settings.autoplayVideoOnSlide&&i!==s&&n.hasClass("lg-complete")&&setTimeout((function(){o.loadAndPlayVideo(i)}),100)},a.prototype.loadAndPlayVideo=function(e){var o=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(o,!0):this.playVideo(e)},a.prototype.playVideo=function(e){this.controlVideo(e,"play")},a.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},a.prototype.getVideoHtml=function(e,o,t,i){var s,n,l,a,c;if(n=this.core.galleryItems[t].__slideVideoInfo||{},(s=this.core.galleryItems[t]).subHtml.includes("<h2>")?l=s.subHtml.split("</h2>")[0].replace("<h2>",""):s.subHtml.includes("<h5>")&&(l=s.subHtml.split("</h5>")[0].replace("<h5>","")),l=l?'title="'+l+'"':"",c='allowtransparency="true"\n frameborder="0"\n scrolling="no"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n oallowfullscreen\n msallowfullscreen',n.youtube){var u="lg-youtube"+t,p=(d(n,this.settings.youTubePlayerParams),e.includes("youtube-nocookie.com"),n.youtube[1]);"youtube",a=`\n <video\n id="${u}"\n class="video-js lg-video-object lg-youtube vjs-theme-uno">\n <source\n type="video/youtube",\n src="//youtube.com/watch?v=${p}"\n >\n\n Your browser does not support HTML5 video.\n </video>\n `}else if(n.vimeo){u="lg-vimeo"+t;var v=function(e,o){if(!o||!o.vimeo)return"";var t=o.vimeo[2]||"",i=Object.assign({},{autoplay:0,muted:1},e),s=i&&0!==Object.keys(i).length?r(i):"",n=((o.vimeo[0].split("/").pop()||"").split("?")[0]||"").split("#")[0],l=o.vimeo[1]!==n;l&&(t=t.replace("/"+n,""));var a=l?"h="+n:"";return"?"+a+(s=a?"&"+s:s)+("?"==t[0]?"&"+t.slice(1):t||"")}(this.settings.vimeoPlayerParams,n);a='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+o+'" '+l+' src="//player.vimeo.com/video/'+(n.vimeo[1]+v)+'" '+c+"></iframe>"}else if(n.wistia){var m="lg-wistia"+t;v=(v=r(this.settings.wistiaPlayerParams))?"?"+v:"",a='<iframe allow="autoplay" id="'+m+'" src="//fast.wistia.net/embed/iframe/'+(n.wistia[4]+v)+'" '+l+' class="wistia_embed lg-video-object lg-wistia '+o+'" name="wistia_embed" '+c+"></iframe>"}else if(n.dailymotion){var h="lg-dailymotion"+t;v=(v=r(this.settings.dailymotionPlayerParams))?"?"+v:"",a=`\n <iframe\n id="${h}"\n src="//dailymotion.com/embed/video/${n.dailymotion[1]}?api=1 ${v}"\n ${l}\n class="dailymotion_embed lg-video-object lg-dailymotiion ${o}"\n name="dailymotion_embed"\n ${c}>\n </iframe>\n `}else if(n.html5){for(var y="",g=0;g<i.source.length;g++){var f=i.source[g].type,b=f?'type="'+f+'"':"";y+='<source src="'+i.source[g].src+'" '+b+">"}if(i.tracks){var k=function(e){var o="",t=i.tracks[e];Object.keys(t||{}).forEach((function(e){o+=e+'="'+t[e]+'" '})),y+="<track "+o+">"};for(g=0;g<i.tracks.length;g++)k(g)}var j="",w=i.attributes||{};Object.keys(w||{}).forEach((function(e){j+=e+'="'+w[e]+'" '})),a='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+j+">\n "+y+"\n Your browser does not support HTML5 video.\n </video>"}return a},a.prototype.appendVideo=function(e,o){var t,i,s={},n=this.getVideoHtml(o.src,o.addClass,o.index,o.html5Video);e.find(".lg-video-cont").append(n);var l=e.find(".lg-video-object").first();if(l.get()){if(o.html5Video&&l.on("mousedown.lg.video",(function(e){e.stopPropagation()})),(s=this.core.galleryItems[o.index].__slideVideoInfo).videojs={enabled:!1},i=n.includes("iframe"),s.videojs.enabled=!i,this.settings.videojs&&(null==s?void 0:s.html5))try{if(s.videojs.enabled)return t=videojs(l.get(),this.settings.videojsOptions),this.settings.vjsPlayer=t,s.videojs.player=t,t}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}if(this.settings.videojs&&(null==s?void 0:s.youtube))try{if(s.videojs.enabled)return t=videojs(l.get(),this.settings.videojsOptions),this.settings.vjsPlayer=t,s.videojs.player=t,t}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}}},a.prototype.gotoNextSlideOnVideoEnd=function(e,o){var t=this,i=this.core.getSlideItem(o).find(".lg-video-object").first();if(i.get()){var s=this.core.galleryItems[o].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd)if(s.html5)i.on("ended",(function(){t.core.goToNextSlide()}));else if(s.vimeo)try{new Vimeo.Player(i.get()).on("ended",(function(){t.core.goToNextSlide()}))}catch(e){console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(s.wistia)try{window._wq=window._wq||[],window._wq.push({id:i.attr("id"),onReady:function(e){e.bind("end",(function(){t.core.goToNextSlide()}))}})}catch(e){console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}}},a.prototype.controlVideo=function(e,o){var t,i,s="not_set";if((t=this.core.getSlideItem(e).find(".lg-video-object").first()).get())if(((i=this.core.galleryItems[e].__slideVideoInfo||{}).html5||i.youtube)&&(void 0!==t.selector.player&&(s=t.selector.player),"not_set"!==s&&c(this,s,i)),i.html5)if(this.settings.videojs)try{videojs(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included videojs")}else t.get()[o]();else if(i.youtube)if(this.settings.videojs)try{videojs(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included videojs")}else try{t.get().contentWindow.postMessage('{"event":"command","func":"'+o+'Video","args":""}',"*")}catch(e){console.error("lightGallery:- "+e)}else if(i.vimeo)try{new Vimeo.Player(t.get())[o]()}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(i.wistia)try{window._wq=window._wq||[],window._wq.push({id:t.attr("id"),onReady:function(e){e[o]()}})}catch(e){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},a.prototype.loadVideoOnPosterClick=function(e,o){var t=this;if(e.hasClass("lg-video-loaded"))o&&this.playVideo(this.core.index);else if(e.hasClass("lg-has-video"))this.playVideo(this.core.index);else{e.addClass("lg-has-video");var i=void 0,s=this.core.galleryItems[this.core.index].src,n=this.core.galleryItems[this.core.index].video;n&&(i="string"==typeof n?JSON.parse(n):n);var l=this.appendVideo(e,{src:s,addClass:"",index:this.core.index,html5Video:i});this.gotoNextSlideOnVideoEnd(s,this.core.index);var a=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(a),e.addClass("lg-video-loading"),l&&l.ready((function(){l.on("loadedmetadata",(function(){t.onVideoLoadAfterPosterClick(e,t.core.index)}))})),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",(function(){setTimeout((function(){t.onVideoLoadAfterPosterClick(e,t.core.index)}),50)}))}},a.prototype.onVideoLoadAfterPosterClick=function(e,o){e.addClass("lg-video-loaded"),this.playVideo(o)},a.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},a}()}));
|