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
@@ -0,0 +1,666 @@
|
|
1
|
+
/*
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# ~/assets/theme/j1/modules/videojs/js/plugins/players/vm/js/vimeo.js
|
4
|
+
# Provides Vimeo Playback Technology (Tech) for Video.js V8 and newer
|
5
|
+
#
|
6
|
+
# Product/Info:
|
7
|
+
# http://jekyll.one
|
8
|
+
#
|
9
|
+
# Copyright (C) 2023-2025 Juergen Adams
|
10
|
+
#
|
11
|
+
# J1 Theme is licensed under MIT License.
|
12
|
+
# See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
|
13
|
+
# -----------------------------------------------------------------------------
|
14
|
+
*/
|
15
|
+
|
16
|
+
/* global define, VM */
|
17
|
+
(function (root, factory) {
|
18
|
+
if(typeof exports==='object' && typeof module!=='undefined') {
|
19
|
+
var videojs = require('video.js');
|
20
|
+
module.exports = factory(videojs.default || videojs);
|
21
|
+
} else if(typeof define === 'function' && define.amd) {
|
22
|
+
define(['videojs'], function(videojs){
|
23
|
+
return (root.Vimeo = factory(videojs));
|
24
|
+
});
|
25
|
+
} else {
|
26
|
+
root.Vimeo = factory(root.videojs);
|
27
|
+
}
|
28
|
+
}(this, function(videojs) {
|
29
|
+
'use strict';
|
30
|
+
|
31
|
+
const isDev = (j1.env === "development" || j1.env === "dev") ? true : false;
|
32
|
+
|
33
|
+
var logger = log4javascript.getLogger('videoJS.plugin.vimeo');
|
34
|
+
var isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_ANDROID;
|
35
|
+
var Tech = videojs.getTech('Tech');
|
36
|
+
var cssInjected = false;
|
37
|
+
var vjsControlbar = false;
|
38
|
+
|
39
|
+
var vjsPlayer;
|
40
|
+
var vjsPoster;
|
41
|
+
var vjsBigPlayButtons;
|
42
|
+
|
43
|
+
var startTimeModule;
|
44
|
+
var endTimeModule;
|
45
|
+
|
46
|
+
class Vimeo extends Tech {
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Vimeo - Wrapper for Video Player API
|
50
|
+
*
|
51
|
+
* @param {Object=} options Object of option names and values
|
52
|
+
* @param {Function=} ready Ready callback function
|
53
|
+
* @extends Tech
|
54
|
+
* @class Vimeo
|
55
|
+
*/
|
56
|
+
constructor(options, ready) {
|
57
|
+
super(options, ready);
|
58
|
+
|
59
|
+
// jadams: VJS controlbar
|
60
|
+
if (vjsControlbar) {
|
61
|
+
var divElement = document.getElementById(options.playerId);
|
62
|
+
divElement.classList.remove("vjs-controls-disabled");
|
63
|
+
divElement.classList.add("vjs-controls-enabled");
|
64
|
+
divElement.classList.remove("vjs-user-inactive");
|
65
|
+
divElement.classList.add("vjs-user-active");
|
66
|
+
} // END if vjsControlbar
|
67
|
+
|
68
|
+
this.setPoster(options.poster);
|
69
|
+
|
70
|
+
// Set the vjs-vimeo class on the player PARENT node.
|
71
|
+
// When not set, yet so we have to wait a tick
|
72
|
+
var vm = this;
|
73
|
+
setTimeout(function() {
|
74
|
+
if (this.el_) {
|
75
|
+
this.el_.parentNode.className += ' vjs-vimeo';
|
76
|
+
|
77
|
+
if (isOnMobile) {
|
78
|
+
this.el_.parentNode.className += ' vjs-vimeo-mobile';
|
79
|
+
}
|
80
|
+
|
81
|
+
if (Vimeo.isSdkReady) {
|
82
|
+
vm.initVMPlayer();
|
83
|
+
} else {
|
84
|
+
Vimeo.sdkReadyQueue.push(vm);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}.bind(this));
|
88
|
+
|
89
|
+
} // END constructor
|
90
|
+
|
91
|
+
initVMPlayer() {
|
92
|
+
// initial vmPlayer settings
|
93
|
+
var vimeoOptions = {
|
94
|
+
url: this.options_.source.src,
|
95
|
+
byline: false,
|
96
|
+
controls: false,
|
97
|
+
portrait: false,
|
98
|
+
title: false,
|
99
|
+
pip: false,
|
100
|
+
vimeo_logo: false
|
101
|
+
};
|
102
|
+
|
103
|
+
// jadams: VJS controlbar
|
104
|
+
if (vjsControlbar) {
|
105
|
+
vimeoOptions.controls = false;
|
106
|
+
} else {
|
107
|
+
vimeoOptions.controls = true;
|
108
|
+
} // END if vjsControlbar
|
109
|
+
|
110
|
+
if (this.options_.autoplay) {
|
111
|
+
vimeoOptions.autoplay = true;
|
112
|
+
}
|
113
|
+
if (this.options_.height) {
|
114
|
+
vimeoOptions.height = this.options_.height;
|
115
|
+
}
|
116
|
+
if (this.options_.width) {
|
117
|
+
vimeoOptions.width = this.options_.width;
|
118
|
+
}
|
119
|
+
if (this.options_.maxheight) {
|
120
|
+
vimeoOptions.maxheight = this.options_.maxheight;
|
121
|
+
}
|
122
|
+
if (this.options_.maxwidth) {
|
123
|
+
vimeoOptions.maxwidth = this.options_.maxwidth;
|
124
|
+
}
|
125
|
+
if (this.options_.loop) {
|
126
|
+
vimeoOptions.loop = this.options_.loop;
|
127
|
+
}
|
128
|
+
if (this.options_.color) {
|
129
|
+
// vimeo is the only API on earth to reject hex color with leading #
|
130
|
+
vimeoOptions.color = this.options_.color.replace(/^#/, '');
|
131
|
+
}
|
132
|
+
|
133
|
+
this.vmPlayer = new VM.Player(this.el(), vimeoOptions);
|
134
|
+
this.initVimeoState();
|
135
|
+
|
136
|
+
// setup API events
|
137
|
+
var apiEvents = [
|
138
|
+
'play', 'playing', 'pause', 'ended', 'loaded',
|
139
|
+
'timeupdate', 'progress', 'seeking', 'seeked',
|
140
|
+
'ready'
|
141
|
+
];
|
142
|
+
apiEvents.forEach(e => {
|
143
|
+
this.vmPlayer.on(e, (progress) => {
|
144
|
+
if (this._vimeoState.progress.duration !== progress.duration) {
|
145
|
+
this.trigger('durationchange');
|
146
|
+
}
|
147
|
+
this._vimeoState.progress = progress;
|
148
|
+
this.trigger(e);
|
149
|
+
});
|
150
|
+
|
151
|
+
this.vmPlayer.on(e, (ready) => {
|
152
|
+
this.vmPlayer.getVideoEmbedCode()
|
153
|
+
.then ((embedCode) => {
|
154
|
+
var code = embedCode;
|
155
|
+
})
|
156
|
+
.catch((error) => {
|
157
|
+
console.err('Vimeo API: an error occurred');
|
158
|
+
});
|
159
|
+
}); // END on ready
|
160
|
+
|
161
|
+
this.vmPlayer.on(e, (timeupdate) => {
|
162
|
+
if (this._vimeoState.progress.duration !== progress.duration) {
|
163
|
+
this.trigger('durationchange');
|
164
|
+
}
|
165
|
+
this._vimeoState.progress = progress;
|
166
|
+
this.trigger(e);
|
167
|
+
});
|
168
|
+
|
169
|
+
this.vmPlayer.on('pause', () => this._vimeoState.playing = false);
|
170
|
+
|
171
|
+
this.vmPlayer.on('play', () => {
|
172
|
+
this._vimeoState.playing = true;
|
173
|
+
this._vimeoState.ended = false;
|
174
|
+
});
|
175
|
+
}); // END forEach apiEvents
|
176
|
+
|
177
|
+
this.vmPlayer.on('ended', () => {
|
178
|
+
this._vimeoState.playing = false;
|
179
|
+
this._vimeoState.ended = true;
|
180
|
+
});
|
181
|
+
|
182
|
+
this.vmPlayer.on('volumechange', (v) => {
|
183
|
+
this._vimeoState.volume = v;
|
184
|
+
});
|
185
|
+
|
186
|
+
this.vmPlayer.on('error', (e) => {
|
187
|
+
this.trigger('error', e);
|
188
|
+
});
|
189
|
+
// END API events
|
190
|
+
|
191
|
+
this.triggerReady();
|
192
|
+
isDev && logger.debug('\n' + 'created ' + this.name_ + ' player on ID: ' + this.el_.firstChild.id);
|
193
|
+
} // END initVMPlayer
|
194
|
+
|
195
|
+
initVimeoState() {
|
196
|
+
|
197
|
+
// remove click event listener
|
198
|
+
function removeClickEvent(event) {
|
199
|
+
event.preventDefault();
|
200
|
+
event.stopPropagation();
|
201
|
+
}
|
202
|
+
|
203
|
+
var state = this._vimeoState = {
|
204
|
+
ended: false,
|
205
|
+
playing: false,
|
206
|
+
muted: false,
|
207
|
+
volume: 0,
|
208
|
+
progress: {
|
209
|
+
seconds: 0,
|
210
|
+
percent: 0,
|
211
|
+
duration: 0
|
212
|
+
}
|
213
|
+
};
|
214
|
+
|
215
|
+
this.vmPlayer.getCurrentTime().then(time => state.progress.seconds = time);
|
216
|
+
this.vmPlayer.getDuration().then(time => state.progress.duration = time);
|
217
|
+
this.vmPlayer.getPaused().then(paused => state.playing = !paused);
|
218
|
+
this.vmPlayer.getVolume().then(volume => state.volume = volume);
|
219
|
+
|
220
|
+
// setTimeout(() => {
|
221
|
+
// // // workaround: remove all pointer cursors from poster images
|
222
|
+
// vjsPoster = document.getElementsByClassName('vjs-poster');
|
223
|
+
// for (var i = 0; i < vjsPoster.length; i++) {
|
224
|
+
// // Remove click event listener from the poster element
|
225
|
+
// vjsPoster[i].removeEventListener('click', (event) => {
|
226
|
+
// // run if clicked without triggering playback
|
227
|
+
// event.preventDefault();
|
228
|
+
// event.stopPropagation();
|
229
|
+
// });
|
230
|
+
// vjsPoster[i].style.cursor = 'default';
|
231
|
+
// } // END for vjsPoster
|
232
|
+
// }, 1000 );
|
233
|
+
|
234
|
+
// jadams: workaround SHOW vjsBigPlayButton
|
235
|
+
if (vjsControlbar) {
|
236
|
+
// native VJS player
|
237
|
+
// do nothing
|
238
|
+
} else {
|
239
|
+
// SHOW vjsBigPlayButton for Vimeo NATIVE players
|
240
|
+
vjsPlayer = videojs(this.options_.playerId);
|
241
|
+
vjsBigPlayButtons = document.getElementsByClassName('vjs-big-play-button');
|
242
|
+
|
243
|
+
for (var i = 0; i < vjsBigPlayButtons.length; i++) {
|
244
|
+
var button = vjsBigPlayButtons[i];
|
245
|
+
if (!button.parentElement.player.controls_) {
|
246
|
+
vjsPlayer.player_.el_.classList.remove("vjs-controls-disabled");
|
247
|
+
}
|
248
|
+
} // END for vjsBigPlayButtons
|
249
|
+
} // END
|
250
|
+
|
251
|
+
} // END initVimeoState
|
252
|
+
|
253
|
+
createEl() {
|
254
|
+
vjsPlayer = videojs(this.options_.playerId);
|
255
|
+
|
256
|
+
var div = document.createElement('div');
|
257
|
+
div.setAttribute('id', this.options_.techId);
|
258
|
+
div.setAttribute('style', 'width:100%; height:100%; top:0; left:0; position:absolute');
|
259
|
+
div.setAttribute('class', 'vjs-tech');
|
260
|
+
|
261
|
+
var techWrapper = document.createElement('div');
|
262
|
+
techWrapper.setAttribute('class', 'vjs-tech-wrapper');
|
263
|
+
techWrapper.appendChild(div);
|
264
|
+
|
265
|
+
var techOverlay = document.createElement('div');
|
266
|
+
techOverlay.setAttribute('class', 'vjs-tech-overlay');
|
267
|
+
// techOverlay.setAttribute('style', 'cursor: pointer; position:absolute; z-index: 1; top:0; left:0; width:100%; height:100%');
|
268
|
+
techOverlay.setAttribute('style', 'cursor: pointer; position:absolute; z-index: 1; top:0; left:0; width:100%; height:100%');
|
269
|
+
techWrapper.appendChild(techOverlay);
|
270
|
+
|
271
|
+
if (vjsControlbar) {
|
272
|
+
// workaround TOGGLE play|pause for Vimmo Tech (click on video)
|
273
|
+
techOverlay.addEventListener('click', (event) => {
|
274
|
+
if (this._vimeoState.playing) {
|
275
|
+
this.vmPlayer.pause();
|
276
|
+
this.trigger('pause');
|
277
|
+
this._vimeoState.playing = false;
|
278
|
+
} else {
|
279
|
+
this.vmPlayer.play();
|
280
|
+
this.trigger('play');
|
281
|
+
this._vimeoState.playing = true;
|
282
|
+
}
|
283
|
+
}); // END EventListener 'click'
|
284
|
+
} else {
|
285
|
+
// workaround PLAY for Vimmo Tech (click on video)
|
286
|
+
techOverlay.addEventListener('click', (event) => {
|
287
|
+
if (!this._vimeoState.playing) {
|
288
|
+
vjsPlayer.player_.el_.classList.add("vjs-controls-disabled");
|
289
|
+
this.vmPlayer.play();
|
290
|
+
this.trigger('play');
|
291
|
+
this._vimeoState.playing = true;
|
292
|
+
} else {
|
293
|
+
// errror in flow
|
294
|
+
} // END if NOT playing
|
295
|
+
// remove techOverlay as it is only required on initial page
|
296
|
+
techOverlay.remove();
|
297
|
+
}, {once: true}); // END EventListener 'click' ONCE
|
298
|
+
} // END if vjsControlbar
|
299
|
+
|
300
|
+
return techWrapper;
|
301
|
+
} // END createEl
|
302
|
+
|
303
|
+
controls() {
|
304
|
+
return true;
|
305
|
+
} // END controls
|
306
|
+
|
307
|
+
supportsFullScreen() {
|
308
|
+
return true;
|
309
|
+
} // END supportsFullScreen
|
310
|
+
|
311
|
+
src() {
|
312
|
+
return this.options_.source;
|
313
|
+
} // END src
|
314
|
+
|
315
|
+
currentSrc() {
|
316
|
+
return this.options_.source.src;
|
317
|
+
} // END currentSrc
|
318
|
+
|
319
|
+
volume() {
|
320
|
+
// return this._vimeoState.volume;
|
321
|
+
this.vmPlayer.getVolume().then((volume) => {
|
322
|
+
// volume = the volume level of the player
|
323
|
+
return volume;
|
324
|
+
}).catch((error) => {
|
325
|
+
// an error occurred
|
326
|
+
});
|
327
|
+
} // END volume
|
328
|
+
|
329
|
+
setVolume(volume) {
|
330
|
+
// return this.vmPlayer.setVolume(volume);
|
331
|
+
|
332
|
+
this.vmPlayer.setVolume(volume).then((volume) => {
|
333
|
+
// volume was set
|
334
|
+
this.trigger('volumechange');
|
335
|
+
return volume;
|
336
|
+
}).catch((error) => {
|
337
|
+
switch (error.name) {
|
338
|
+
case 'RangeError':
|
339
|
+
// the volume was less than 0 or greater than 1
|
340
|
+
break;
|
341
|
+
default:
|
342
|
+
// some other error occurred
|
343
|
+
break;
|
344
|
+
}
|
345
|
+
});
|
346
|
+
} // END setVolume
|
347
|
+
|
348
|
+
muted() {
|
349
|
+
var player = videojs(this.options_.playerId);
|
350
|
+
this.vmPlayer.getMuted().then((muted) => {
|
351
|
+
// muted = whether muted is turned on or not
|
352
|
+
}).catch((error) => {
|
353
|
+
// an error occurred
|
354
|
+
});
|
355
|
+
} // END muted
|
356
|
+
|
357
|
+
setMuted(mute) {
|
358
|
+
var player = videojs(this.options_.playerId);
|
359
|
+
var isMuted = !this._vimeoState.muted; // toggle mute state
|
360
|
+
var _this = this;
|
361
|
+
|
362
|
+
this.vmPlayer.setMuted(isMuted).then((muted) => {
|
363
|
+
_this._vimeoState.muted = muted;
|
364
|
+
}).catch((error) => {
|
365
|
+
// an error occurred
|
366
|
+
});
|
367
|
+
} // END setMuted
|
368
|
+
|
369
|
+
buffered() {
|
370
|
+
const progress = this._vimeoState.progress;
|
371
|
+
return videojs.time.createTimeRanges(0, progress.percent * progress.duration);
|
372
|
+
} // END buffered
|
373
|
+
|
374
|
+
paused() {
|
375
|
+
return !this._vimeoState.playing;
|
376
|
+
} // END paused
|
377
|
+
|
378
|
+
pause() {
|
379
|
+
this.vmPlayer.pause();
|
380
|
+
this._vimeoState.playing = false;
|
381
|
+
} // END pause
|
382
|
+
|
383
|
+
play() {
|
384
|
+
vjsPlayer.player_.el_.classList.add("vjs-controls-disabled");
|
385
|
+
this.vmPlayer.play();
|
386
|
+
this._vimeoState.playing = true;
|
387
|
+
} // END play
|
388
|
+
|
389
|
+
ended() {
|
390
|
+
return this._vimeoState.ended;
|
391
|
+
} // END ended
|
392
|
+
|
393
|
+
// currentTime() {
|
394
|
+
// var currentTime = this.vmPlayer ? this.vmPlayer.getCurrentTime() : 0;
|
395
|
+
// return currentTime;
|
396
|
+
// }
|
397
|
+
|
398
|
+
currentTime() {
|
399
|
+
this.vmPlayer.getCurrentTime().then((seconds) => {
|
400
|
+
// seconds = the current playback position
|
401
|
+
return seconds;
|
402
|
+
}).catch((error) => {
|
403
|
+
// an error occurred
|
404
|
+
});
|
405
|
+
} // END currentTime
|
406
|
+
|
407
|
+
// currentTime() {
|
408
|
+
// return this._vimeoState.progress.seconds;
|
409
|
+
// } // END
|
410
|
+
//
|
411
|
+
// setCurrentTime(time) {
|
412
|
+
// // this.vmPlayer.setCurrentTime(time);
|
413
|
+
// this.vmPlayer.setCurrentTime(30.456).then(function(seconds) {
|
414
|
+
// // seconds = the actual time that the player seeked to
|
415
|
+
// var currentTime = seconds
|
416
|
+
// }).catch(function(error) {
|
417
|
+
// switch (error.name) {
|
418
|
+
// case 'RangeError':
|
419
|
+
// // the time was less than 0 or greater than the video’s duration
|
420
|
+
// break;
|
421
|
+
// default:
|
422
|
+
// // some other error occurred
|
423
|
+
// break;
|
424
|
+
// }
|
425
|
+
// });
|
426
|
+
// } // END setCurrentTime
|
427
|
+
|
428
|
+
setCurrentTime(seconds) {
|
429
|
+
if (this.lastState === vmPlayer.getPaused()) {
|
430
|
+
this.timeBeforeSeek = this.currentTime();
|
431
|
+
}
|
432
|
+
|
433
|
+
if (!this.isSeeking) {
|
434
|
+
this.wasPausedBeforeSeek = this.paused();
|
435
|
+
}
|
436
|
+
|
437
|
+
this.vmPlayer.seekTo(seconds, true);
|
438
|
+
this.trigger('timeupdate');
|
439
|
+
this.trigger('seeking');
|
440
|
+
this.isSeeking = true;
|
441
|
+
|
442
|
+
// A seek event during pause does not return an event to trigger a seeked event,
|
443
|
+
// so run an interval timer to look for the currentTime to change
|
444
|
+
if (this.lastState === vmPlayer.getPaused() && this.timeBeforeSeek !== seconds) {
|
445
|
+
clearInterval(this.checkSeekedInPauseInterval);
|
446
|
+
this.checkSeekedInPauseInterval = setInterval(function() {
|
447
|
+
if (this.lastState !== vmPlayer.getPaused() || !this.isSeeking) {
|
448
|
+
// If something changed while we were waiting for the currentTime to change,
|
449
|
+
// clear the interval timer
|
450
|
+
clearInterval(this.checkSeekedInPauseInterval);
|
451
|
+
} else if (this.currentTime() !== this.timeBeforeSeek) {
|
452
|
+
this.trigger('timeupdate');
|
453
|
+
this.onSeeked();
|
454
|
+
}
|
455
|
+
}.bind(this), 250);
|
456
|
+
}
|
457
|
+
} // END setCurrentTime
|
458
|
+
|
459
|
+
seeking() {
|
460
|
+
return this.isSeeking;
|
461
|
+
} // END seeking
|
462
|
+
|
463
|
+
// jadams, 2023-10-01: videojs.createTimeRange() deprecated in VideoJS 9
|
464
|
+
//
|
465
|
+
seekable() {
|
466
|
+
if(!this.vmPlayer) {
|
467
|
+
// return videojs.createTimeRange();
|
468
|
+
return videojs.time.createTimeRanges();
|
469
|
+
}
|
470
|
+
// return videojs.createTimeRange(0, this.vmPlayer.getDuration());
|
471
|
+
return videojs.time.createTimeRanges(0, this.vmPlayer.getDuration());
|
472
|
+
} // END seekable
|
473
|
+
|
474
|
+
onSeeked() {
|
475
|
+
clearInterval(this.checkSeekedInPauseInterval);
|
476
|
+
this.isSeeking = false;
|
477
|
+
|
478
|
+
if (this.wasPausedBeforeSeek) {
|
479
|
+
this.pause();
|
480
|
+
}
|
481
|
+
|
482
|
+
this.trigger('seeked');
|
483
|
+
} // END onSeeked
|
484
|
+
|
485
|
+
playbackRate() {
|
486
|
+
return this.vmPlayer ? this.vmPlayer.getPlaybackRate() : 1;
|
487
|
+
} // END playbackRate
|
488
|
+
|
489
|
+
setPlaybackRate(suggestedRate) {
|
490
|
+
if (!this.vmPlayer) {
|
491
|
+
return;
|
492
|
+
}
|
493
|
+
|
494
|
+
this.vmPlayer.setPlaybackRate(suggestedRate);
|
495
|
+
} // END setPlaybackRate
|
496
|
+
|
497
|
+
duration() {
|
498
|
+
this.vmPlayer.getDuration().then((duration) => {
|
499
|
+
// duration = the duration of the video in seconds
|
500
|
+
return duration;
|
501
|
+
}).catch((error) => {
|
502
|
+
// an error occurred
|
503
|
+
});
|
504
|
+
} // END duration
|
505
|
+
|
506
|
+
} // END class Vimeo
|
507
|
+
|
508
|
+
Vimeo.prototype.featuresTimeupdateEvents = true;
|
509
|
+
|
510
|
+
Vimeo.isSupported = () => {
|
511
|
+
return true;
|
512
|
+
};
|
513
|
+
|
514
|
+
// Add Source Handler pattern functions to this tech
|
515
|
+
Tech.withSourceHandlers(Vimeo);
|
516
|
+
|
517
|
+
Vimeo.nativeSourceHandler = {};
|
518
|
+
|
519
|
+
/**
|
520
|
+
* Check if Vimeo can play the given videotype
|
521
|
+
* @param {String} type The mimetype to check
|
522
|
+
* @return {String} 'maybe', or '' (empty string)
|
523
|
+
*/
|
524
|
+
Vimeo.nativeSourceHandler.canPlayType = (source) => {
|
525
|
+
if (source === 'video/vimeo') {
|
526
|
+
return 'maybe';
|
527
|
+
}
|
528
|
+
};
|
529
|
+
|
530
|
+
/*
|
531
|
+
* Check Vimeo can handle the source natively
|
532
|
+
*
|
533
|
+
* @param {Object} source The source object
|
534
|
+
* @return {String} 'maybe', or '' (empty string)
|
535
|
+
* @note: Copied over from YouTube — not sure this is relevant
|
536
|
+
*/
|
537
|
+
Vimeo.nativeSourceHandler.canHandleSource = (source) => {
|
538
|
+
if (source.type) {
|
539
|
+
return Vimeo.nativeSourceHandler.canPlayType(source.type);
|
540
|
+
} else if (source.src) {
|
541
|
+
return Vimeo.nativeSourceHandler.canPlayType(source.src);
|
542
|
+
}
|
543
|
+
};
|
544
|
+
|
545
|
+
// @note: Copied over from YouTube — not sure this is relevant
|
546
|
+
Vimeo.nativeSourceHandler.handleSource = (source, tech) => {
|
547
|
+
tech.src(source.src);
|
548
|
+
};
|
549
|
+
|
550
|
+
// @note: Copied over from YouTube — not sure this is relevant
|
551
|
+
Vimeo.nativeSourceHandler.dispose = () => {};
|
552
|
+
|
553
|
+
Vimeo.registerSourceHandler(Vimeo.nativeSourceHandler);
|
554
|
+
|
555
|
+
// Include the version number
|
556
|
+
Vimeo.VERSION = '1.0.0';
|
557
|
+
|
558
|
+
Vimeo.sdkReadyQueue = [];
|
559
|
+
|
560
|
+
// Since the iframe can't be touched using Vimeo's way of embedding,
|
561
|
+
// let's add a new styling rule to have the same style as `vjs-tech`
|
562
|
+
//
|
563
|
+
function injectCss() {
|
564
|
+
if (cssInjected) {
|
565
|
+
return;
|
566
|
+
}
|
567
|
+
cssInjected = true;
|
568
|
+
|
569
|
+
const css = `
|
570
|
+
.vjs-vimeo iframe {
|
571
|
+
position: absolute;
|
572
|
+
top: 0;
|
573
|
+
left: 0;
|
574
|
+
width: 100%;
|
575
|
+
height: 100%;
|
576
|
+
}
|
577
|
+
.vjs-vimeo-mobile .vjs-big-play-button {
|
578
|
+
display: none;
|
579
|
+
}
|
580
|
+
`;
|
581
|
+
|
582
|
+
const head = document.head || document.getElementsByTagName('head')[0];
|
583
|
+
const style = document.createElement('style');
|
584
|
+
style.type = 'text/css';
|
585
|
+
|
586
|
+
if (style.styleSheet) {
|
587
|
+
style.styleSheet.cssText = css;
|
588
|
+
} else {
|
589
|
+
style.appendChild(document.createTextNode(css));
|
590
|
+
}
|
591
|
+
|
592
|
+
isDev && logger.debug('\n' + 'added additional CSS styles');
|
593
|
+
head.appendChild(style);
|
594
|
+
} // END injectCss
|
595
|
+
|
596
|
+
function apiLoaded() {
|
597
|
+
Vimeo.isSdkReady = true;
|
598
|
+
|
599
|
+
for (var i = 0; i < Vimeo.sdkReadyQueue.length; ++i) {
|
600
|
+
Vimeo.sdkReadyQueue[i].initVMPlayer();
|
601
|
+
}
|
602
|
+
isDev && logger.debug('\n' + 'created all players from queue: #' + i);
|
603
|
+
|
604
|
+
endTimeModule = Date.now();
|
605
|
+
isDev && logger.debug('\n' + 'initializing plugin: finished');
|
606
|
+
isDev && logger.debug('\n' + 'plugin initializing time: ' + (endTimeModule-startTimeModule) + 'ms');
|
607
|
+
} // END apiLoaded
|
608
|
+
|
609
|
+
function loadScript(src, callback) {
|
610
|
+
var loaded = false;
|
611
|
+
var tag = document.createElement('script');
|
612
|
+
var firstScriptTag = document.getElementsByTagName('script')[0];
|
613
|
+
|
614
|
+
if (!firstScriptTag) {
|
615
|
+
// when loaded in jest without jsdom setup it doesn't get any element.
|
616
|
+
// In jest it doesn't really make sense to do anything, because no
|
617
|
+
// one is watching dailymotion in jest
|
618
|
+
return;
|
619
|
+
}
|
620
|
+
|
621
|
+
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
622
|
+
tag.onload = () => {
|
623
|
+
if (!loaded) {
|
624
|
+
loaded = true;
|
625
|
+
callback();
|
626
|
+
}
|
627
|
+
};
|
628
|
+
|
629
|
+
tag.onreadystatechange = () => {
|
630
|
+
if (!loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {
|
631
|
+
loaded = true;
|
632
|
+
callback();
|
633
|
+
}
|
634
|
+
};
|
635
|
+
|
636
|
+
tag.src = src;
|
637
|
+
} // END loadScript
|
638
|
+
|
639
|
+
// initialize plugin if page ready
|
640
|
+
// -------------------------------------------------------------------------
|
641
|
+
var dependencies_met_page_ready = setInterval (() => {
|
642
|
+
var pageState = $('#content').css("display");
|
643
|
+
var pageVisible = (pageState === 'block') ? true : false;
|
644
|
+
var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
|
645
|
+
|
646
|
+
if (j1CoreFinished && pageVisible) {
|
647
|
+
startTimeModule = Date.now();
|
648
|
+
|
649
|
+
isDev && logger.debug('\n' + 'initializing plugin: started');
|
650
|
+
isDev && logger.debug('\n' + 'version of videoJS detected: ' + videojs.VERSION);
|
651
|
+
|
652
|
+
// load script loaded from local because (original) NemeSpace conflicts (Vimeo -> VM)
|
653
|
+
loadScript('/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.js', apiLoaded);
|
654
|
+
injectCss();
|
655
|
+
clearInterval(dependencies_met_page_ready);
|
656
|
+
} // END pageVisible
|
657
|
+
}, 10); // END dependencies_met_page_ready
|
658
|
+
|
659
|
+
// Check VJS versions to register Wistia TECH
|
660
|
+
if (typeof videojs.registerTech !== 'undefined') {
|
661
|
+
videojs.registerTech('Vimeo', Vimeo);
|
662
|
+
} else {
|
663
|
+
console.error('\n' + 'invalid version of videoJS detected: ' + videojs.VERSION);
|
664
|
+
}
|
665
|
+
|
666
|
+
}));
|