j1-template 2024.3.26 → 2024.3.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 863665110de39165f05b3ff8fce421714c74786530d82a9844cef6efe7d1ef76
4
- data.tar.gz: d2bd8b2196b7085eeb66009889cdec408b037a311c396dc61ebcdc26133df7ee
3
+ metadata.gz: 313ef844ffd93a5fe0a2a9e84a8714946bf48fed40e3c8955c8f375b7d79393a
4
+ data.tar.gz: c12bc3717d97a98e0095298f5991a8b952dcf6ac35091d22cdb6102462a59214
5
5
  SHA512:
6
- metadata.gz: '0706961249004127034ecde0c1630dbae53a4c8d6f97f86dd6be4d59c49ccee961bcbf5cc6717fb0d7210068a816fd77b936c2eb2d191bbf5b2bcd0dca849d69'
7
- data.tar.gz: ddb463db603fb7d9edb3ce2e5495631deb24dcbc921055b9967ea257a0b6dea746809120968396a9742e9d452dbc13a81d3282f09813d76a0e2e346f32103988
6
+ metadata.gz: 6cfbc7429c4aa5c4fc0be2989867ac4e88aa5f0bc991bc8db9fdbd31ef96a0a44c4717c33f568fa7b0e12152a121ec8e57d047ef73ce63075bdd6bd8f4c74d1d
7
+ data.tar.gz: b5b48ea9d4d3491208e4de7edf597f842aa01cf2a1e2b67d520b363b05fa88d80bebaa5dd6b092e2aa4859fd55fcf81f4d1e6a587e4f3e51bec2caa65474967b
@@ -119,8 +119,8 @@ j1.adapter.videojs = ((j1, window) => {
119
119
  vjsSettings = $.extend({}, {{videojs_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
120
120
  vjsOptions = $.extend(true, {}, vjsDefaults, vjsSettings);
121
121
 
122
- _this = j1.adapter.videojs;
123
- logger = log4javascript.getLogger('j1.adapter.videojs');
122
+ _this = j1.adapter.videojs;
123
+ logger = log4javascript.getLogger('j1.adapter.videojs');
124
124
 
125
125
  // -----------------------------------------------------------------------
126
126
  // module initializer
@@ -137,9 +137,11 @@ j1.adapter.videojs = ((j1, window) => {
137
137
  logger.debug('state: ' + _this.getState());
138
138
  logger.info('module is being initialized');
139
139
 
140
- // save vjsOptions for later access
141
- j1.modules.videojs = {};
142
- j1.modules.videojs.options = vjsOptions || {};
140
+ // save vjsOptions|data for later access
141
+ j1.modules.videojs = {};
142
+ j1.modules.videojs.options = vjsOptions || {};
143
+ j1.modules.videojs.data = {};
144
+ j1.modules.videojs.data.players = {}; // set initial value
143
145
 
144
146
  _this.setState('finished');
145
147
  logger.debug('state: ' + _this.getState());
@@ -211,4 +213,4 @@ j1.adapter.videojs = ((j1, window) => {
211
213
  {{ cache|strip_empty_lines }}
212
214
  {%- endif -%}
213
215
 
214
- {%- assign cache = false -%}
216
+ {%- assign cache = false -%}
@@ -232,20 +232,126 @@
232
232
  // -------------------------------------------------------------------------
233
233
  var vjsProcessExtendedButtonsAndPlugins = function (vjsObject, videojsPlayer, videoInfo) {
234
234
  const vjsOptions = j1.modules.videojs.options;
235
- var dependency_met_module_ready, videoInfo, videoStart, videojsPlayer,
236
- playbackRates, hotKeysPlugin, skipButtonsPlugin, zoomPlugin,
237
- trackSrc;
235
+ var dependency_met_module_ready, videoInfo, playerState,
236
+ videoStart, videojsPlayer, playbackRates,
237
+ hotKeysPlugin, skipButtonsPlugin, zoomPlugin;
238
238
 
239
- dependency_met_module_ready = setInterval (() => {
239
+
240
+ // ---------------------------------------------------------------------
241
+ // helper functions
242
+ // =====================================================================
243
+
244
+ // remove existng markers
245
+ // ---------------------------------------------------------------------
246
+ function removeChapterMarkers(timeline, currentPlayerId) {
247
+ timeline.find('.vjs-chapter-marker').remove();
248
+ }
249
+
250
+ // get player status
251
+ // ---------------------------------------------------------------------
252
+ function getPlayerStatus(player) {
253
+ return {
254
+ paused: player.paused(),
255
+ currentTime: player.currentTime(),
256
+ duration: player.duration(),
257
+ muted: player.muted(),
258
+ bufferedPercent: player.bufferedPercent()
259
+ };
260
+ }
261
+
262
+ // check if player is playing
263
+ // ---------------------------------------------------------------------
264
+ function isPlaying (player) {
265
+ var vjsIsPlaying = (!player.paused() || player.currentTime() > 0) ? true : false;
266
+
267
+ return vjsIsPlaying;
268
+ }
269
+
270
+ // set chapter markers for the player (videojsPlayer) specified
271
+ // ---------------------------------------------------------------------
272
+ function addChapterMarkers(videojsPlayer) {
273
+ var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
274
+ var playerID = videojsPlayer.id();
275
+ var parser = new WebVTTParser();
276
+ var markers = [];
277
+
278
+ function cb_load (data /* ,textStatus, jqXHR */ ) {
279
+ var tree = parser.parse(data, 'metadata');
280
+ var marker;
281
+
282
+ // add chapter tracks to markers array
283
+ for (var i=0; i<tree.cues.length; i++) {
284
+ marker = { time: tree.cues[i].startTime, label: tree.cues[i].text };
285
+ markers.push(marker);
286
+ }
287
+ }; // END function cb_load
288
+
289
+ // create chapter tracks from source file
290
+ // -----------------------------------------------------------------
291
+ loadVtt(videojsPlayer.chapterTracksSource, cb_load);
292
+
293
+ // failsafe: remove already existing markers for current player
294
+ removeChapterMarkers(timeline, playerID);
295
+
296
+ // if tracks available, add (chapter) tracks on timeline
297
+ // -----------------------------------------------------------------
298
+ if (j1.modules.videojs.data.players[playerID].videoData.tracks.length) {
299
+ setTimeout (function() {
300
+ var markers_loaded = setInterval (function () {
301
+ if (markers.length) {
302
+ const duration = videojsPlayer.duration();
303
+
304
+ for (var i=0; i<markers.length; i++) {
305
+ var left = (markers[i].time / duration * 100) + '%';
306
+ var time = markers[i].time;
307
+
308
+ // add (unique) marker element
309
+ var el = $(
310
+ '<div class="vjs-chapter-marker" ' +
311
+ 'style="left: ' + left + '" ' +
312
+ 'data-time="' + time + '" ' +
313
+ 'data-player-id="' + playerID + '">' +
314
+ '<span>' + markers[i].label + '</span></div>'
315
+ );
316
+
317
+ // event handler with closure for correct player reference
318
+ (function(currentPlayer, markerTime) {
319
+ el.click(function() {
320
+ currentPlayer.currentTime(markerTime);
321
+ });
322
+ })(videojsPlayer, time);
323
+
324
+ timeline.append(el);
325
+ }
326
+
327
+ clearInterval(markers_loaded);
328
+ } else {
329
+ clearInterval(markers_loaded);
330
+ } // END if markers.length
331
+ }, 10); // END interval markers_loaded
332
+ }, 100 ); // END timeout
333
+ } // END if chapterTracks enabled
334
+ } // END addChapterMarkers
335
+
336
+
337
+ // ---------------------------------------------------------------------
338
+ // main
339
+ // =====================================================================
340
+ dependency_met_module_ready = setInterval (() => {
341
+ var playerId, videoData, timeline;
240
342
  var isModuleInitialised = (j1.adapter.gallery.getState() === 'finished') ? true : false;
241
343
  var isVideojsOptions = (isEmpty(vjsObject.settings.videojsOptions)) ? false : true;
242
344
 
243
345
  if (isModuleInitialised && isVideojsOptions) {
244
- var videoData = { tracks: false };
245
- var playbackRatesDefaults = vjsOptions.playbackRates.values;
346
+ playerId = videojsPlayer.id();
347
+ videoData = { tracks: [] };
348
+ playerState = getPlayerStatus(videojsPlayer);
246
349
 
247
- // disable chapterTracks by default
248
- videojsPlayer.chapterTracksEnabled = false;
350
+ // set (initial) videoData tracks.chapters to empty array
351
+ videoData.tracks.chapters = [];
352
+
353
+ // ENABLE chapter tracks by default (to enable very first checks)
354
+ // videojsPlayer.chapterTracksEnabled = true;
249
355
 
250
356
  var hotKeysPluginDefaults = {
251
357
  volumeStep: vjsOptions.plugins.hotKeys.volumeStep,
@@ -424,101 +530,90 @@
424
530
 
425
531
  } // END if zoom Plugin enabled
426
532
 
427
- // chapter tracks only available for VideoJS (local video/mp4)
533
+
534
+ // chapter track processing, only available for VideoJS
428
535
  // ---------------------------------------------------------
429
536
  if (vjsObject.core.galleryItems[vjsObject.core.index].video !== undefined) {
430
537
  videoData = JSON.parse(vjsObject.core.galleryItems[vjsObject.core.index].video);
538
+ videojsPlayer.videoData = videoData;
539
+
540
+ // save VJS videoData for later use
541
+ // NOTE: for unknown reasons, lightGallery generates
542
+ // WRONG videoData on skip forwaed|backward a video slide
543
+ // Workaround: do NOT overwrite existing video data
544
+ // stored in current window (j1.modules.videojs.data)
545
+ // -----------------------------------------------------
546
+ if (j1.modules.videojs.data.players[playerId] === undefined) {
547
+ j1.modules.videojs.data.players[playerId] = {};
548
+ j1.modules.videojs.data.players[playerId]['videoData'] = {};
549
+ j1.modules.videojs.data.players[playerId].videoData['tracks'] = videoData.tracks || [];
550
+ }
431
551
  }
432
552
 
433
- // load tracks
434
- // TODO: chapterTracksEnabled needs to be indivialized
435
- // per player
553
+ // load source file for chapter tracks
436
554
  // ---------------------------------------------------------
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
- }
555
+ var chapterTracksSrc;
556
+ for (var i=0; i<videojsPlayer.videoData.tracks.length; i++) {
557
+ if (videojsPlayer.videoData.tracks[i].kind == 'chapters') {
558
+ chapterTracksSrc = videojsPlayer.videoData.tracks[i].src;
559
+ videojsPlayer.chapterTracksSource = chapterTracksSrc;
443
560
  }
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);
561
+ }
471
562
 
472
- var total = videojsPlayer.duration();
473
- var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
563
+ // process chapter tracks
564
+ if (j1.modules.videojs.data.players[playerId].videoData.tracks.length) {
565
+ playerId = videojsPlayer.id();
566
+ timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
474
567
 
475
- // remove old|previous markers
476
- timeline.find('.vjs-chapter-marker').remove();
568
+ removeChapterMarkers(timeline, playerId);
477
569
 
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();
570
+ // add chapter tracks when playing alreay (e.g. autoplay)
571
+ // -----------------------------------------------------
572
+ if (isPlaying(videojsPlayer)) {
573
+ addChapterMarkers(videojsPlayer)
574
+ } // END if VideoJS player isPlaying
484
575
 
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>');
576
+ // jadams, 2025-06-22: prepare settting start position
577
+ // TODO: coding is to be continued
578
+ // -----------------------------------------------------
579
+ // videojsPlayer.currentTime(videoStart);
489
580
 
490
- el.click(function() {
491
- videojsPlayer.currentTime($(this).data('time'));
492
- });
581
+ // remove chapter tracks on event 'pause'
582
+ // -----------------------------------------------------
583
+ videojsPlayer.on("pause", function() {
584
+ var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
493
585
 
494
- timeline.append(el);
495
- }
496
- clearInterval(markers_loaded);
497
- }
498
- }, 10); // END markers_loaded
499
- }, 100 ); // END setTimeout
586
+ removeChapterMarkers(timeline, videojsPlayer.id());
587
+ }); // END on event 'pause'
500
588
 
501
- });
502
- } else {
503
- // remove chapter tracks on playing
504
- // -----------------------------------------------------
589
+ // add chapter tracks on event 'play'
590
+ // -----------------------------------------------------
505
591
  videojsPlayer.on("play", function() {
506
- videojsPlayer.chapterTracksEnabled = false;
507
- var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
592
+ addChapterMarkers(videojsPlayer)
593
+ }); // END on event 'play'
508
594
 
509
- // remove existing markers
510
- timeline.find('.vjs-chapter-marker').remove();
595
+ // failsafe: remove chapter markers on the player removed||destroyed
596
+ videojsPlayer.on("dispose", function() {
597
+ var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
511
598
 
599
+ // remove already existing markers for the player destroyed
600
+ removeChapterMarkers(timeline, videojsPlayer.id());
512
601
  });
513
602
 
514
- } // END remove chapter tracks
603
+ } else {
604
+ // remove existing chapter markers if NO tracks enabled
605
+ var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
606
+ var playerId = videojsPlayer.id();
607
+
608
+ removeChapterMarkers(timeline, playerId);
609
+ } // END if chapterTracks enabled
515
610
 
516
611
  } // END if videojsOptions
517
612
 
518
613
  clearInterval(dependency_met_module_ready);
519
614
  } // END if isModuleInitialised
520
615
 
521
- }, 10); // END dependency_met_page_ready
616
+ }, 10); // END interval dependency_met_module_ready
522
617
 
523
618
  }; // END vjsProcessExtendedButtonsAndPlugins
524
619
 
@@ -16,4 +16,5 @@
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 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}()}));
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",a="lgPosterClick",l=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,a,r,d,c,u;function p(e,o){e.find(".vjs-chapter-marker").remove()}function v(e){var o,t,i=$(e.controlBar.progressControl.children_[0].el_),s=e.id(),n=new WebVTTParser,a=[];o=e.chapterTracksSource,t=function(e){for(var o,t=n.parse(e,"metadata"),i=0;i<t.cues.length;i++)o={time:t.cues[i].startTime,label:t.cues[i].text},a.push(o)},new WebVTTParser,$.ajax({url:o,type:"GET",success:t,error:function(e){JSON.stringify(e,void 0,2)}}),p(i),j1.modules.videojs.data.players[s].videoData.tracks.length&&setTimeout((function(){var o=setInterval((function(){if(a.length){const d=e.duration();for(var t=0;t<a.length;t++){var n=a[t].time/d*100+"%",l=a[t].time,r=$('<div class="vjs-chapter-marker" style="left: '+n+'" data-time="'+l+'" data-player-id="'+s+'"><span>'+a[t].label+"</span></div>");!function(e,o){r.click((function(){e.currentTime(o)}))}(e,l),i.append(r)}clearInterval(o)}else clearInterval(o)}),10)}),100)}n=setInterval((()=>{var m,h,y="finished"===j1.adapter.gallery.getState(),g=!l(o.settings.videojsOptions);if(y&&g){_=t.id(),m={tracks:[]},{paused:(h=t).paused(),currentTime:h.currentTime(),duration:h.duration(),muted:h.muted(),bufferedPercent:h.bufferedPercent()},m.tracks.chapters=[];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},j={moveX:s.plugins.zoomButtons.moveX,moveY:s.plugins.zoomButtons.moveY,rotate:s.plugins.zoomButtons.rotate,zoom:s.plugins.zoomButtons.zoom},k=t.controlBar;const y=k.addChild("Component",{el:videojs.dom.createEl("div",{className:"vjs-theme-uno custom-progressbar-container"})}),g=k.progressControl;g&&y.el().appendChild(g.el());const O=k.currentTimeDisplay;O&&y.el().insertBefore(O.el(),g.el());const C=k.durationDisplay;if(C&&y.el().appendChild(C.el()),!l(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&&(a=o.settings.videojsOptions.videoStart[index],t.on("play",(function(){var e=new Date("1970-01-01T"+a+"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({},j),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})}var S;void 0!==o.core.galleryItems[o.core.index].video&&(m=JSON.parse(o.core.galleryItems[o.core.index].video),t.videoData=m,void 0===j1.modules.videojs.data.players[_]&&(j1.modules.videojs.data.players[_]={},j1.modules.videojs.data.players[_].videoData={},j1.modules.videojs.data.players[_].videoData.tracks=m.tracks||[]));for(var x=0;x<t.videoData.tracks.length;x++)"chapters"==t.videoData.tracks[x].kind&&(S=t.videoData.tracks[x].src,t.chapterTracksSource=S);if(j1.modules.videojs.data.players[_].videoData.tracks.length)_=t.id(),p(I=$(t.controlBar.progressControl.children_[0].el_)),function(e){return!e.paused()||e.currentTime()>0}(t)&&v(t),t.on("pause",(function(){p($(t.controlBar.progressControl.children_[0].el_),t.id())})),t.on("play",(function(){v(t)})),t.on("dispose",(function(){p($(t.controlBar.progressControl.children_[0].el_),t.id())}));else{var I=$(t.controlBar.progressControl.children_[0].el_),_=t.id();p(I)}}clearInterval(n)}}),10)};return function(){function l(t){return this.core=t,this.settings=e(e({},o),this.core.settings),this}return l.prototype.init=function(){var e=this;this.core.LGel.on(t+".video",this.onHasVideo.bind(this)),this.core.LGel.on(a+".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))},l.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)},l.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))},l.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var o=e.detail.prevIndex;this.pauseVideo(o)}},l.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)},l.prototype.loadAndPlayVideo=function(e){var o=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(o,!0):this.playVideo(e)},l.prototype.playVideo=function(e){this.controlVideo(e,"play")},l.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},l.prototype.getVideoHtml=function(e,o,t,i){var s,n,a,l,c;if(n=this.core.galleryItems[t].__slideVideoInfo||{},(s=this.core.galleryItems[t]).subHtml.includes("<h2>")?a=s.subHtml.split("</h2>")[0].replace("<h2>",""):s.subHtml.includes("<h5>")&&(a=s.subHtml.split("</h5>")[0].replace("<h5>","")),a=a?'title="'+a+'"':"",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",l=`\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],a=o.vimeo[1]!==n;a&&(t=t.replace("/"+n,""));var l=a?"h="+n:"";return"?"+l+(s=l?"&"+s:s)+("?"==t[0]?"&"+t.slice(1):t||"")}(this.settings.vimeoPlayerParams,n);l='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+o+'" '+a+' 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:"",l='<iframe allow="autoplay" id="'+m+'" src="//fast.wistia.net/embed/iframe/'+(n.wistia[4]+v)+'" '+a+' 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:"",l=`\n <iframe\n id="${h}"\n src="//dailymotion.com/embed/video/${n.dailymotion[1]}?api=1 ${v}"\n ${a}\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 j=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++)j(g)}var k="",w=i.attributes||{};Object.keys(w||{}).forEach((function(e){k+=e+'="'+w[e]+'" '})),l='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+k+">\n "+y+"\n Your browser does not support HTML5 video.\n </video>"}return l},l.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 a=e.find(".lg-video-object").first();if(a.get()){if(o.html5Video&&a.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(a.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(a.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")}}},l.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")}}},l.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")}},l.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 a=this.appendVideo(e,{src:s,addClass:"",index:this.core.index,html5Video:i});this.gotoNextSlideOnVideoEnd(s,this.core.index);var l=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(l),e.addClass("lg-video-loading"),a&&a.ready((function(){a.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)}))}},l.prototype.onVideoLoadAfterPosterClick=function(e,o){e.addClass("lg-video-loaded"),this.playVideo(o)},l.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},l}()}));
20
+
@@ -78,13 +78,12 @@
78
78
  }
79
79
 
80
80
  /* auto HIDE VJS controlbar when video is PAUSED */
81
- /*
82
81
  .vjs-has-started.vjs-user-inactive.vjs-paused .vjs-control-bar {
83
82
  visibility: visible;
84
83
  opacity: 0;
85
84
  transition: visibility 1s, opacity 1s;
86
85
  }
87
- */
86
+
88
87
 
89
88
  /* manage time (display) divider, remaining-time */
90
89
  .vjs-theme-uno .vjs-time-divider,
data/lib/j1/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module J1
2
- VERSION = '2024.3.26'
2
+ VERSION = '2024.3.27'
3
3
  end
@@ -379,7 +379,7 @@ This command creates a **initial** project in folder **my-starter**.
379
379
  2023-02-28 18:12:12 - GENERATE: Resolving dependencies...
380
380
  2023-02-28 18:12:12 - GENERATE: Using bundler 2.3.7
381
381
  ...
382
- 2023-02-28 18:12:12 - GENERATE: Using j1-template 2024.3.26
382
+ 2023-02-28 18:12:12 - GENERATE: Using j1-template 2024.3.27
383
383
  2023-02-28 18:12:12 - GENERATE: Bundle complete! 31 Gemfile dependencies, 78 gems now installed.
384
384
  2023-02-28 18:12:12 - GENERATE: Bundled gems are installed into `../../.gem`
385
385
  2023-02-28 18:12:12 - GENERATE: C:/Users/xxx/.gem/ruby/3.1.0;C:/DevTools/Ruby31-x64/lib/ruby/gems/3.1.0;
@@ -415,7 +415,7 @@ commands are available as well.
415
415
  2023-02-28 18:17:48 - SETUP: Initialize the project ...
416
416
  2023-02-28 18:17:48 - SETUP: Be patient, this will take a while ...
417
417
  2023-02-28 18:17:49 - SETUP:
418
- 2023-02-28 18:17:49 - SETUP: > j1@2024.3.26 setup C:\Users\xxx\j1-projects\my-starter
418
+ 2023-02-28 18:17:49 - SETUP: > j1@2024.3.27 setup C:\Users\xxx\j1-projects\my-starter
419
419
  2023-02-28 18:17:49 - SETUP: > npm --silent run setup-start && npm --silent run setup-base && run-s -s setup:*
420
420
  2023-02-28 18:17:49 - SETUP:
421
421
  2023-02-28 18:17:50 - SETUP: Setup project for first use ..
@@ -460,7 +460,7 @@ browser. Let's start the journey ...
460
460
  Check setup state of the J1 project ...
461
461
  2023-02-28 18:26:18 - SITE: Starting up your site ...
462
462
  2023-02-28 18:26:18 - SITE:
463
- 2023-02-28 18:26:18 - SITE: > j1@2024.3.26 j1-site C:\Users\jadams\j1-projects\my-starter
463
+ 2023-02-28 18:26:18 - SITE: > j1@2024.3.27 j1-site C:\Users\jadams\j1-projects\my-starter
464
464
  2023-02-28 18:26:18 - SITE: > run-p -s j1-site:*
465
465
  2023-02-28 18:26:18 - SITE:
466
466
  2023-02-28 18:26:20 - SITE: Startup UTILSRV ..
@@ -499,7 +499,7 @@ Check setup state of the J1 project ...
499
499
  REBUILD: Rebuild the projects website ...
500
500
  REBUILD: Be patient, this will take a while ...
501
501
  2023-02-28 18:45:09 - REBUILD:
502
- 2023-02-28 18:45:09 - REBUILD: > j1@2024.3.26 rebuild C:\Users\xxx\j1-projects\my-starter
502
+ 2023-02-28 18:45:09 - REBUILD: > j1@2024.3.27 rebuild C:\Users\xxx\j1-projects\my-starter
503
503
  2023-02-28 18:45:09 - REBUILD: > run-s -s rebuild:* && run-s -s post-rebuild:*
504
504
  2023-02-28 18:45:09 - REBUILD:
505
505
  2023-02-28 18:45:10 - REBUILD: Rebuild site incremental ..
@@ -547,7 +547,7 @@ using Lerna for all packages:
547
547
  2023-02-28 18:29:07 - RESET: Reset the project to factory state ...
548
548
  2023-02-28 18:29:07 - RESET: Be patient, this will take a while ...
549
549
  2023-02-28 18:29:08 - RESET:
550
- 2023-02-28 18:29:08 - RESET: > j1@2024.3.26 reset C:\Users\xxx\j1-projects\my-starter
550
+ 2023-02-28 18:29:08 - RESET: > j1@2024.3.27 reset C:\Users\xxx\j1-projects\my-starter
551
551
  2023-02-28 18:29:08 - RESET: > run-s -s reset:*
552
552
  2023-02-28 18:29:08 - RESET:
553
553
  2023-02-28 18:29:08 - RESET: Reset project to factory state ..
@@ -53,7 +53,7 @@ environment: development
53
53
  # ------------------------------------------------------------------------------
54
54
  # Sets the build version of the site
55
55
  #
56
- version: 2024.3.26
56
+ version: 2024.3.27
57
57
 
58
58
  # copyright
59
59
  # ------------------------------------------------------------------------------
@@ -57,7 +57,7 @@
57
57
  <id>{{ page.url | absolute_url | xml_escape }}</id>
58
58
  <post_limited>{{ limit_posts }}</post_limited>
59
59
  <template_name>J1 Theme</template_name>
60
- <template_version>2024.3.26</template_version>
60
+ <template_version>2024.3.27</template_version>
61
61
 
62
62
  {% assign title = site.title | default: site.name %}
63
63
  {% if page.collection != "posts" %}
@@ -394,6 +394,6 @@ end
394
394
 
395
395
  module Jekyll
396
396
  module J1LunrSearch
397
- VERSION = '2024.3.26'
397
+ VERSION = '2024.3.27'
398
398
  end
399
399
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": true,
3
3
  "name": "j1",
4
- "version": "2024.3.26",
4
+ "version": "2024.3.27",
5
5
  "description": "J1 Template",
6
6
  "homepage": "https://your.site",
7
7
  "author": {
@@ -4,7 +4,7 @@ title_extention: YouTube Video
4
4
  tagline: YouTube Video
5
5
 
6
6
  date: 2024-09-21
7
- #last_modified: 2024-01-01
7
+ last_modified: 2025-06-22
8
8
 
9
9
  description: >
10
10
  The J1 Template support playing video on web pages
@@ -17,7 +17,7 @@ keywords: >
17
17
  quicktime, silverlight
18
18
 
19
19
  categories: [ Tester ]
20
- tags: [ Audio, Amplitude App, YouTube ]
20
+ tags: [ AmpltitudeJS, YouTube ]
21
21
 
22
22
  image:
23
23
  path: /assets/image/module/attic/1920x1280/markus-spiske.jpg
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  title: VideoJS
3
- title_extention: Custom VJS Players
4
- tagline: Custom VJS Players
3
+ title_extention: Custom video player
4
+ tagline: Custom video player
5
5
 
6
6
  date: 2025-06-05
7
- last_modified: 2025-06-08
7
+ last_modified: 2025-06-22
8
8
 
9
9
  description: >
10
10
  Test the VideoJS ADOC Macro for
@@ -16,7 +16,7 @@ keywords: >
16
16
  videojs
17
17
 
18
18
  categories: [ Tester ]
19
- tags: [ Module, VideoJS ]
19
+ tags: [ VideoJS, YouTube ]
20
20
 
21
21
  image:
22
22
  path: /assets/image/module/attic/markus-spiske-1920x1280.jpg
@@ -49,7 +49,10 @@ resource_options:
49
49
 
50
50
  // Attribute settings for section control
51
51
  //
52
- :swiper--features: false
52
+ :videojs--youtube-video: false
53
+ :videojs--masonry: false
54
+ :videojs--local-video: true
55
+ :videojs--over-youtube: true
53
56
 
54
57
  // Set (local) page attributes here
55
58
  // -----------------------------------------------------------------------------
@@ -67,119 +70,94 @@ resource_options:
67
70
  // Page content
68
71
  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
72
  [role="dropcap"]
70
- Swiper, the free and most modern mobile touch slider with hardware accelerated
71
- transitions and amazing native behavior. It is intended to be used in mobile
72
- websites, mobile web apps, and mobile native/hybrid apps.
73
+ VideoJS is a *free-to-use* open-source JavaScript framework for building
74
+ custom video players for the web. Implementing VideoJS for the J1 Template
75
+ supports local video and several platforms, such as YouTube, Vimeo, Wistia,
76
+ or Dailymotion, for presenting videos *online*.
77
+
73
78
 
74
79
  // Include sub-documents (if any)
75
80
  // -----------------------------------------------------------------------------
76
- // [role="mt-5"]
77
- // == Local Video
78
-
79
- // Videos created by a digicam or a mobile can be played by J1 Template using
80
- // the lightGallery integration. Present videos you have made at it's best.
81
-
82
- // .Local Video over VideoJS · Justified Gallery + LightGallery
83
- // gallery::jg_video_html5[role="mb-4"]
84
-
85
-
86
- // == Masonry
87
-
88
- // Masonry for J1 Template is a great tool for creating dynamic video galleries.
89
- // The module makes creating a gallery to display videos of different types easy.
90
-
91
- // .Mixed Video · Masonry + LightGallery
92
- // masonry::mixed_video_example[role="mb-4"]
93
-
94
-
95
- // [role="mt-4"]
96
- // == lightGallery (YouTube)
97
-
98
- // The galley maker *justifiedGallery* in combination with the *lightbox*
99
- // lightGallery is a great toolset for creating dynamic video galleries.
100
- // The module combinati0n makes creating a gallery to access videos easy.
101
-
102
- // .YouTube Video · justifiedGallery + LightGallery
103
- // gallery::jg_video_youtube_james_and_adele[role="mb-4"]
104
-
105
-
106
- // [role="mt-5"]
107
- // == VideoJS Player over YouTube
108
-
109
- // YouTube is a popular online video-sharing platform that allows users to
110
- // upload, view, share, and comment on videos. The platform provides services
111
- // for people and organizations to publish various video content.
112
-
113
- // ++++
114
- // <div class="video-title">
115
- // <i class="mdib mdib-video mdib-24px mr-2"></i>
116
- // The Breathtaking Beauty of Nature
117
- // </div>
118
-
119
- // <div class="mb-8">
120
- // <video
121
- // id="vid_2rtQOsWaAXc"
122
- // class="video-js vjs-theme-uno"
123
- // controls
124
- // width="640"
125
- // height="360"
126
- // poster="//img.youtube.com/vi/IUN664s7N-c/maxresdefault.jpg" alt="Beauty of Nature"
127
- // aria-label="The Breathtaking Beauty of Nature"
128
- // data-setup='{
129
- // "fluid" : true,
130
- // "techOrder": [
131
- // "youtube", "html5"
132
- // ],
133
- // "sources": [{
134
- // "type": "video/youtube",
135
- // "src": "//youtube.com/watch?v=IUN664s7N-c"
136
- // }],
137
- // "controlBar": {
138
- // "pictureInPictureToggle": false,
139
- // "volumePanel": {
140
- // "inline": false
141
- // }
142
- // }
143
- // }'
144
- // ></video>
145
- // </div>
146
- // ++++
147
81
 
82
+ ifeval::[{videojs--local-video} == true]
83
+ [role="mt-5"]
84
+ == Local Video
85
+
86
+ Videos created by a digicam or a mobile can be played by J1 Template using
87
+ the lightGallery integration. Present videos you have made at it's best.
88
+
89
+ .Local (MP4) Video · Justified Gallery + LightGallery
90
+ gallery::jg_video_html5[role="mb-4"]
91
+ endif::[]
92
+
93
+
94
+ ifeval::[{videojs--masonry} == true]
95
+ [role="mt-5"]
96
+ == Masonry
97
+
98
+ Masonry for J1 Template is a great tool for creating dynamic video galleries.
99
+ The module makes creating a gallery to display videos of different types easy.
100
+
101
+ .Mixed Video · Masonry + LightGallery
102
+ masonry::mixed_video_example[role="mb-4"]
103
+ endif::[]
104
+
105
+
106
+ ifeval::[{videojs--youtube-video} == true]
107
+ [role="mt-5"]
108
+ == lightGallery (YouTube)
109
+
110
+ The galley maker *justifiedGallery* in combination with the *lightbox*
111
+ lightGallery is a great toolset for creating dynamic video galleries.
112
+ The module combinati0n makes creating a gallery to access videos easy.
113
+
114
+ .YouTube Video · justifiedGallery + LightGallery
115
+ gallery::jg_video_youtube_james_and_adele[role="mb-4"]
116
+ endif::[]
117
+
118
+
119
+ ifeval::[{videojs--over-youtube} == true]
148
120
  [role="mt-5"]
149
- == VideoJS Player over Dailymotion
121
+ == VideoJS Player over YouTube
122
+
123
+ YouTube is a popular online video-sharing platform that allows users to
124
+ upload, view, share, and comment on videos. The platform provides services
125
+ for people and organizations to publish various video content.
126
+
127
+ ++++
128
+ <style>
150
129
 
151
- link:{url-dailymotion--home}[Dailymotion, {browser-window--new}] is a
152
- video-sharing platform. The platform is available worldwide in 180+
153
- languages, featuring websites for their video content.
130
+ /* -----------------------------------------------------------------------------
131
+ styles moved to VJS theme uno at:
132
+ assets/theme/j1/modules/videojs/css/themes/uno.css
133
+ */
154
134
 
155
- The platform is a *monetization* solution that allows allows to directly
156
- connect to high-quality advertisers through a proprietary Advertising system.
157
- Like YouTube, videos can be watched for free, but ads are shown on each and
158
- every video.
135
+ </style>
136
+ ++++
159
137
 
160
138
  ++++
161
139
  <div class="video-title">
162
140
  <i class="mdib mdib-video mdib-24px mr-2"></i>
163
- Morning Energy
141
+ The Breathtaking Beauty of Nature
164
142
  </div>
165
143
 
166
144
  <div class="mb-8">
167
145
  <video
168
- id="vid_x887s09"
146
+ id="2rtQOsWaAXc"
169
147
  class="video-js vjs-theme-uno"
170
148
  controls
171
149
  width="640"
172
150
  height="360"
173
- poster="/assets/video/poster/dailymotion/meditation.jpg" alt="Morning Energy"
174
- aria-label="Morning Energy"
151
+ poster="//img.youtube.com/vi/IUN664s7N-c/maxresdefault.jpg" alt="Beauty of Nature"
152
+ aria-label="The Breathtaking Beauty of Nature"
175
153
  data-setup='{
176
154
  "fluid" : true,
177
155
  "techOrder": [
178
- "dailymotion", "html5"
156
+ "youtube", "html5"
179
157
  ],
180
158
  "sources": [{
181
- "type": "video/dailymotion",
182
- "src": "//dai.ly/x887s09"
159
+ "type": "video/youtube",
160
+ "src": "//youtube.com/watch?v=IUN664s7N-c"
183
161
  }],
184
162
  "controlBar": {
185
163
  "pictureInPictureToggle": false,
@@ -192,18 +170,6 @@ every video.
192
170
  </div>
193
171
  ++++
194
172
 
195
-
196
- ++++
197
- <style>
198
-
199
- /* -----------------------------------------------------------------------------
200
- styles moved to VJS theme uno at:
201
- assets/theme/j1/modules/videojs/css/themes/uno.css
202
- */
203
-
204
- </style>
205
- ++++
206
-
207
173
  ++++
208
174
  <script>
209
175
 
@@ -247,7 +213,7 @@ $(function() {
247
213
  // create div|caption container
248
214
  const newDiv = document.createElement('div');
249
215
  newDiv.classList.add('caption');
250
- newDiv.textContent = 'Morning Energy';
216
+ newDiv.textContent = 'The Breathtaking Beauty of Nature';
251
217
 
252
218
  // insert div|caption container AFTER the image
253
219
  image.parentNode.insertBefore(newDiv, image.nextSibling);
@@ -265,17 +231,15 @@ $(function() {
265
231
  var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
266
232
 
267
233
  if (j1CoreFinished && pageVisible) {
268
- // const vjs_player = document.getElementById("vid_2rtQOsWaAXc");
269
- const vjs_player = document.getElementById('vid_x887s09');
234
+ const vjs_player = document.getElementById("2rtQOsWaAXc");
270
235
 
271
236
  // add captions (on poster image)
272
- // naddCaptionAfterImage('//img.youtube.com/vi/IUN664s7N-c/maxresdefault.jpg');
273
- addCaptionAfterImage('/assets/video/poster/dailymotion/meditation.jpg');
274
-
237
+ addCaptionAfterImage('//img.youtube.com/vi/IUN664s7N-c/maxresdefault.jpg');
238
+
275
239
  // scroll page to the players top position
276
240
  // -----------------------------------------------------------------------
277
241
  vjs_player.addEventListener('click', function(event) {
278
- const targetDiv = document.getElementById("vid_x887s09");
242
+ const targetDiv = document.getElementById("2rtQOsWaAXc");
279
243
  const targetDivPosition = targetDiv.offsetTop;
280
244
  const scrollOffset = (window.innerWidth >= 720) ? -130 : -110;
281
245
 
@@ -290,12 +254,12 @@ $(function() {
290
254
  // customize the yt player created
291
255
  // ---------------------------------------------------------------------------
292
256
  var dependencies_met_vjs_player_exist = setInterval(function(options) {
293
- var vjsPlayerExist = document.getElementById("vid_x887s09") ? true : false;
257
+ var vjsPlayerExist = document.getElementById("2rtQOsWaAXc") ? true : false;
294
258
 
295
259
  if (vjsPlayerExist) {
296
260
 
297
261
  // apply player customization on 'player ready'
298
- videojs("vid_x887s09").ready(function() {
262
+ videojs("2rtQOsWaAXc").ready(function() {
299
263
  const vjsPlayer = this;
300
264
 
301
265
  // create customControlContainer for progressControlSilder|time (display) elements
@@ -367,4 +331,4 @@ $(function() {
367
331
 
368
332
  </script>
369
333
  ++++
370
-
334
+ endif::[]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: j1-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 2024.3.26
4
+ version: 2024.3.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - juergen_jekyll_one
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-06-19 00:00:00.000000000 Z
11
+ date: 2025-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll