@carbon/ibmdotcom-web-components 2.42.0 → 2.44.0
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.
- package/custom-elements.json +694 -21
- package/dist/dotcom-shell.js +2 -2
- package/dist/dotcom-shell.min.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
- package/dist/{index-1c798fbb.js → index-61a58423.js} +1126 -820
- package/dist/{index-0582e43b.js → index-ec9bb3a7.js} +325 -325
- package/dist/{left-nav-menu-222d7e12.js → left-nav-menu-1ff7160b.js} +2 -2
- package/dist/{left-nav-menu-fbe31764.js → left-nav-menu-7d664773.js} +2 -2
- package/dist/{left-nav-menu-category-heading-bad5c9a4.js → left-nav-menu-category-heading-3fda0fd5.js} +2 -2
- package/dist/{left-nav-menu-category-heading-d40df38d.js → left-nav-menu-category-heading-df0252db.js} +2 -2
- package/dist/{left-nav-menu-item-1c789f3b.js → left-nav-menu-item-b217b8fd.js} +2 -2
- package/dist/{left-nav-menu-item-d8292202.js → left-nav-menu-item-caa0c565.js} +2 -2
- package/dist/{left-nav-menu-section-722a4f08.js → left-nav-menu-section-d00e6604.js} +2 -2
- package/dist/{left-nav-menu-section-ad075d07.js → left-nav-menu-section-dbde241d.js} +2 -2
- package/dist/{left-nav-overlay-c4bce0ba.js → left-nav-overlay-cd84d0bc.js} +2 -2
- package/dist/{left-nav-overlay-6931a643.js → left-nav-overlay-f5867fdc.js} +2 -2
- package/dist/{megamenu-category-group-b28f721d.js → megamenu-category-group-251cebcf.js} +2 -2
- package/dist/{megamenu-category-group-6a9005b2.js → megamenu-category-group-802948a9.js} +2 -2
- package/dist/{megamenu-category-group-copy-09e2b942.js → megamenu-category-group-copy-484e9b27.js} +2 -2
- package/dist/{megamenu-category-group-copy-a1712d7f.js → megamenu-category-group-copy-7efee05a.js} +2 -2
- package/dist/{megamenu-category-heading-b5cf4e2d.js → megamenu-category-heading-2190977a.js} +2 -2
- package/dist/{megamenu-category-heading-d1c1fa95.js → megamenu-category-heading-315eb114.js} +2 -2
- package/dist/{megamenu-category-link-aeb6f7d6.js → megamenu-category-link-3d42179f.js} +2 -2
- package/dist/{megamenu-category-link-2c38f1b8.js → megamenu-category-link-84c22ab0.js} +2 -2
- package/dist/{megamenu-category-link-group-492f73c5.js → megamenu-category-link-group-3cdb6bfc.js} +2 -2
- package/dist/{megamenu-category-link-group-c7ade8c5.js → megamenu-category-link-group-94e4b16c.js} +2 -2
- package/dist/{megamenu-left-navigation-328b8153.js → megamenu-left-navigation-b5b03849.js} +2 -2
- package/dist/{megamenu-left-navigation-015a1a3e.js → megamenu-left-navigation-ee2dc6e8.js} +2 -2
- package/dist/{megamenu-overlay-763b7455.js → megamenu-overlay-646b736f.js} +2 -2
- package/dist/{megamenu-overlay-a9dcb9ea.js → megamenu-overlay-6a12d82a.js} +2 -2
- package/dist/{megamenu-tab-9623c21c.js → megamenu-tab-5490376a.js} +2 -2
- package/dist/{megamenu-tab-faaeff5a.js → megamenu-tab-99df887a.js} +2 -2
- package/es/components/back-to-top/__stories__/back-to-top.stories.css.js +1 -1
- package/es/components/card-group/card-group.css.js +1 -1
- package/es/components/card-section-offset/card-section-offset.css.js +1 -1
- package/es/components/card-section-simple/card-section-simple.css.js +1 -1
- package/es/components/content-block/content-block.css.js +1 -1
- package/es/components/content-block-cards/content-block-cards.css.js +1 -1
- package/es/components/content-block-media/content-block-media.css.js +1 -1
- package/es/components/content-section/content-section.css.js +1 -1
- package/es/components/cta-block/cta-block.css.js +1 -1
- package/es/components/cta-section/cta-section.css.js +1 -1
- package/es/components/dotcom-shell/dotcom-shell.css.js +1 -1
- package/es/components/footer/footer-composite.d.ts +10 -10
- package/es/components/footer/footer-composite.js +78 -53
- package/es/components/footer/footer-composite.js.map +1 -1
- package/es/components/footer/footer-container.d.ts +4 -3
- package/es/components/footer/footer-container.js +8 -5
- package/es/components/footer/footer-container.js.map +1 -1
- package/es/components/footer/footer.css.js +1 -1
- package/es/components/global-banner/global-banner.css.js +1 -1
- package/es/components/leadspace/leadspace.css.js +1 -1
- package/es/components/leadspace-with-search/leadspace-with-search.css.js +1 -1
- package/es/components/link-list-section/link-list-section.css.js +1 -1
- package/es/components/locale-modal/locale-modal.css.js +1 -1
- package/es/components/masthead/masthead-cart.d.ts +1 -0
- package/es/components/masthead/masthead-cart.js +23 -5
- package/es/components/masthead/masthead-cart.js.map +1 -1
- package/es/components/masthead/masthead-l1.css.js +1 -1
- package/es/components/masthead/masthead.css.js +1 -1
- package/es/components/table-of-contents/table-of-contents-cdn.css.js +1 -1
- package/es/components/table-of-contents/table-of-contents.css.js +1 -1
- package/es/components/table-of-contents/table-of-contents.d.ts +1 -1
- package/es/components/table-of-contents/table-of-contents.js +15 -2
- package/es/components/table-of-contents/table-of-contents.js.map +1 -1
- package/es/components/video-player-v7/defs.d.ts +42 -0
- package/es/components/video-player-v7/defs.js +46 -0
- package/es/components/video-player-v7/defs.js.map +1 -0
- package/es/components/video-player-v7/index.d.ts +11 -0
- package/es/components/video-player-v7/index.js +18 -0
- package/es/components/video-player-v7/index.js.map +1 -0
- package/es/components/video-player-v7/video-player-composite.d.ts +873 -0
- package/es/components/video-player-v7/video-player-composite.js +705 -0
- package/es/components/video-player-v7/video-player-composite.js.map +1 -0
- package/es/components/video-player-v7/video-player-container.d.ts +1219 -0
- package/es/components/video-player-v7/video-player-container.js +392 -0
- package/es/components/video-player-v7/video-player-container.js.map +1 -0
- package/es/components/video-player-v7/video-player.css.js +12 -0
- package/es/components/video-player-v7/video-player.d.ts +807 -0
- package/es/components/video-player-v7/video-player.js +577 -0
- package/es/components/video-player-v7/video-player.js.map +1 -0
- package/es/components-react/footer/footer-container.d.ts +1 -1
- package/es/components-react/video-player-v7/defs.js +9 -0
- package/es/components-react/video-player-v7/video-player-composite.d.ts +32 -0
- package/es/components-react/video-player-v7/video-player-container.d.ts +19 -0
- package/es/components-react/video-player-v7/video-player.d.ts +37 -0
- package/es/globals/scss/themes.css.js +1 -1
- package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js +366 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/index.js +8 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.d.ts +54 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js +88 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js.map +1 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/reducers/kalturaPlayerAPIv7.d.ts +18 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/reducers/kalturaPlayerAPIv7.js +88 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/reducers/kalturaPlayerAPIv7.js.map +1 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7.d.ts +77 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7.js +36 -0
- package/es/internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7.js.map +1 -0
- package/lib/components/video-player-v7/defs.js +50 -0
- package/lib/components/video-player-v7/defs.js.map +1 -0
- package/lib/components-react-node/video-player-v7/defs.js +24 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js +371 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/index.js +13 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js +104 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js.map +1 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/reducers/kalturaPlayerAPIv7.js +94 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/reducers/kalturaPlayerAPIv7.js.map +1 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7.js +39 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7.js.map +1 -0
- package/package.json +7 -7
- package/scss/components/video-player-v7/video-player.scss +8 -0
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
import _decorate from "@babel/runtime/helpers/esm/decorate";
|
|
2
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
3
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
4
|
+
let _ = t => t,
|
|
5
|
+
_t,
|
|
6
|
+
_t2;
|
|
7
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2020, 2024
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { LitElement, html } from 'lit';
|
|
18
|
+
import { property, state } from 'lit/decorators.js';
|
|
19
|
+
import HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';
|
|
20
|
+
import HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';
|
|
21
|
+
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
|
|
22
|
+
import KalturaPlayerAPI from '@carbon/ibmdotcom-services/es/services/KalturaPlayerV7/KalturaPlayer.js';
|
|
23
|
+
import HybridRenderMixin from "../../globals/mixins/hybrid-render.js";
|
|
24
|
+
import { VIDEO_PLAYER_CONTENT_STATE, VIDEO_PLAYER_PLAYING_MODE } from "./video-player.js";
|
|
25
|
+
// Above import is interface-only ref and thus code won't be brought into the build
|
|
26
|
+
// Above import is interface-only ref and thus code won't be brought into the build
|
|
27
|
+
// Above import is interface-only ref and thus code won't be brought into the build
|
|
28
|
+
import "./video-player.js";
|
|
29
|
+
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
|
|
30
|
+
import { BUTTON_POSITION } from "./defs.js";
|
|
31
|
+
import ifNonEmpty from '@carbon/web-components/es/globals/directives/if-non-empty.js';
|
|
32
|
+
const {
|
|
33
|
+
stablePrefix: c4dPrefix
|
|
34
|
+
} = settings;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Component that renders video player from its metadata, etc.
|
|
38
|
+
*
|
|
39
|
+
* @element c4d-video-player-composite-v7
|
|
40
|
+
* @csspart video-player - The video player. Usage `c4d-video-player-composite-v7::part(video-player)`
|
|
41
|
+
*/
|
|
42
|
+
let C4DVideoPlayerComposite = _decorate([customElement(`${c4dPrefix}-video-player-composite-v7`)], function (_initialize, _HybridRenderMixin) {
|
|
43
|
+
class C4DVideoPlayerComposite extends _HybridRenderMixin {
|
|
44
|
+
constructor(...args) {
|
|
45
|
+
super(...args);
|
|
46
|
+
_initialize(this);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
F: C4DVideoPlayerComposite,
|
|
51
|
+
d: [{
|
|
52
|
+
kind: "method",
|
|
53
|
+
key: "_activateEmbeddedVideo",
|
|
54
|
+
value:
|
|
55
|
+
/**
|
|
56
|
+
* The placeholder for `_loadVideoData()` Redux action that may be mixed in.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The placeholder for `_loadVideoData()` Redux action that may be mixed in.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The placeholder for `_setAutoplayPreference()` Redux action that may be mixed in.
|
|
69
|
+
*/
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The placeholder for `_getAutoplayPreference()` Redux action that may be mixed in.
|
|
74
|
+
*/
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Activate the DOM nodes for the embedded video of the given video ID, and deactivates others.
|
|
79
|
+
*
|
|
80
|
+
* @param videoId The video ID to activate.
|
|
81
|
+
*/
|
|
82
|
+
function _activateEmbeddedVideo(videoId) {
|
|
83
|
+
const {
|
|
84
|
+
embeddedVideos = {}
|
|
85
|
+
} = this;
|
|
86
|
+
Object.keys(embeddedVideos).forEach(key => {
|
|
87
|
+
const kalturaPlayer = embeddedVideos[key];
|
|
88
|
+
key === videoId ? kalturaPlayer.play() : kalturaPlayer.pause();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The video player.
|
|
94
|
+
*/
|
|
95
|
+
}, {
|
|
96
|
+
kind: "get",
|
|
97
|
+
key: "_videoPlayer",
|
|
98
|
+
value: function () {
|
|
99
|
+
const {
|
|
100
|
+
selectorVideoPlayer
|
|
101
|
+
} = this.constructor;
|
|
102
|
+
return this.querySelector(selectorVideoPlayer);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Clean-up and create intersection observers.
|
|
107
|
+
*
|
|
108
|
+
* When this.intersectionMode, we use intersection observers to track when
|
|
109
|
+
* the video container is in view, and embed / play / pause the video
|
|
110
|
+
* accordingly.
|
|
111
|
+
*
|
|
112
|
+
* @param [options] The options.
|
|
113
|
+
* @param [options.create] `true` to create necessary intersection observers.
|
|
114
|
+
*/
|
|
115
|
+
}, {
|
|
116
|
+
kind: "method",
|
|
117
|
+
key: "_cleanAndCreateObserverIntersection",
|
|
118
|
+
value: function _cleanAndCreateObserverIntersection({
|
|
119
|
+
create
|
|
120
|
+
} = {}) {
|
|
121
|
+
// Cleanup.
|
|
122
|
+
if (this._observerIntersectionIntoView) {
|
|
123
|
+
this._observerIntersectionIntoView.unobserve(this);
|
|
124
|
+
}
|
|
125
|
+
if (this._observerIntersectionOutOfView) {
|
|
126
|
+
this._observerIntersectionOutOfView.unobserve(this);
|
|
127
|
+
}
|
|
128
|
+
// Create new intersection observers.
|
|
129
|
+
if (create) {
|
|
130
|
+
this._observerIntersectionIntoView = new IntersectionObserver(this._intersectionIntoViewHandler.bind(this), {
|
|
131
|
+
root: this.closest('c4d-carousel'),
|
|
132
|
+
rootMargin: '0px',
|
|
133
|
+
threshold: 0.9
|
|
134
|
+
});
|
|
135
|
+
this._observerIntersectionOutOfView = new IntersectionObserver(this._intersectionOutOfViewHandler.bind(this), {
|
|
136
|
+
root: this.closest('c4d-carousel'),
|
|
137
|
+
rootMargin: '0px',
|
|
138
|
+
threshold: 0.5
|
|
139
|
+
});
|
|
140
|
+
this._observerIntersectionIntoView.observe(this);
|
|
141
|
+
this._observerIntersectionOutOfView.observe(this);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Observer for when the video container enters into view.
|
|
147
|
+
*
|
|
148
|
+
* Autoplay the video, resecting the users stored autoplay preference.
|
|
149
|
+
*/
|
|
150
|
+
}, {
|
|
151
|
+
kind: "method",
|
|
152
|
+
key: "_intersectionIntoViewHandler",
|
|
153
|
+
value: function _intersectionIntoViewHandler(entries) {
|
|
154
|
+
const {
|
|
155
|
+
videoId
|
|
156
|
+
} = this;
|
|
157
|
+
entries.forEach(entry => {
|
|
158
|
+
if (entry.isIntersecting && this._getAutoplayPreference() !== false) {
|
|
159
|
+
var _this$_embedMedia;
|
|
160
|
+
(_this$_embedMedia = this._embedMedia) === null || _this$_embedMedia === void 0 || _this$_embedMedia.call(this, videoId);
|
|
161
|
+
this.playAllVideos();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Observer for when the video container goes out of view.
|
|
168
|
+
*
|
|
169
|
+
* Auto-pause the video, video playback controlled by intersection observers
|
|
170
|
+
* here are meant to be ambient, without audio. No reason for playback when
|
|
171
|
+
* user is not seeing the video content.
|
|
172
|
+
*/
|
|
173
|
+
}, {
|
|
174
|
+
kind: "method",
|
|
175
|
+
key: "_intersectionOutOfViewHandler",
|
|
176
|
+
value: function _intersectionOutOfViewHandler(entries) {
|
|
177
|
+
entries.forEach(entry => {
|
|
178
|
+
if (!entry.isIntersecting) {
|
|
179
|
+
this.pauseAllVideos(false);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Handles `c4d-video-player-content-state-changed` event.
|
|
186
|
+
* Such event is fired when user changes video content state, e.g. from thumbnail to video player.
|
|
187
|
+
*
|
|
188
|
+
* @param event The event.
|
|
189
|
+
*/
|
|
190
|
+
}, {
|
|
191
|
+
kind: "method",
|
|
192
|
+
decorators: [HostListener('eventContentStateChange')],
|
|
193
|
+
key: "_handleContentStateChange",
|
|
194
|
+
value: function _handleContentStateChange(event) {
|
|
195
|
+
const {
|
|
196
|
+
contentState,
|
|
197
|
+
playingMode,
|
|
198
|
+
videoId
|
|
199
|
+
} = event.detail;
|
|
200
|
+
if (contentState === VIDEO_PLAYER_CONTENT_STATE.VIDEO && playingMode === VIDEO_PLAYER_PLAYING_MODE.INLINE && videoId) {
|
|
201
|
+
var _this$_embedMedia2;
|
|
202
|
+
(_this$_embedMedia2 = this._embedMedia) === null || _this$_embedMedia2 === void 0 || _this$_embedMedia2.call(this, videoId);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
kind: "method",
|
|
207
|
+
decorators: [HostListener('eventPlaybackStateChange')],
|
|
208
|
+
key: "_handlePlaybackStateChange",
|
|
209
|
+
value: function _handlePlaybackStateChange(event) {
|
|
210
|
+
const {
|
|
211
|
+
videoId
|
|
212
|
+
} = event.detail;
|
|
213
|
+
const {
|
|
214
|
+
embeddedVideos = {}
|
|
215
|
+
} = this;
|
|
216
|
+
if (this.isPlaying) {
|
|
217
|
+
embeddedVideos[videoId].pause();
|
|
218
|
+
this.isPlaying = false;
|
|
219
|
+
} else {
|
|
220
|
+
embeddedVideos[videoId].play();
|
|
221
|
+
this.isPlaying = true;
|
|
222
|
+
}
|
|
223
|
+
this._setAutoplayPreference(this.isPlaying);
|
|
224
|
+
this.playbackTriggered = true;
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
kind: "method",
|
|
228
|
+
decorators: [HostListener('eventTogglePlayback')],
|
|
229
|
+
key: "_handleEventTogglePlayback",
|
|
230
|
+
value: function _handleEventTogglePlayback(event) {
|
|
231
|
+
const {
|
|
232
|
+
videoId
|
|
233
|
+
} = event.detail;
|
|
234
|
+
if (videoId) {
|
|
235
|
+
var _this$_embedMedia3;
|
|
236
|
+
this._setAutoplayPreference(!this.isPlaying);
|
|
237
|
+
|
|
238
|
+
// First ensure that the media has actually been embedded.
|
|
239
|
+
(_this$_embedMedia3 = this._embedMedia) === null || _this$_embedMedia3 === void 0 || _this$_embedMedia3.call(this, videoId);
|
|
240
|
+
if (this.isPlaying) {
|
|
241
|
+
this.pauseAllVideos();
|
|
242
|
+
} else {
|
|
243
|
+
this.playAllVideos();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
kind: "method",
|
|
249
|
+
key: "pauseAllVideos",
|
|
250
|
+
value: function pauseAllVideos(updateAutoplayPreference = true) {
|
|
251
|
+
const {
|
|
252
|
+
embeddedVideos = {}
|
|
253
|
+
} = this;
|
|
254
|
+
Object.keys(embeddedVideos).forEach(videoId => {
|
|
255
|
+
var _embeddedVideos$video;
|
|
256
|
+
(_embeddedVideos$video = embeddedVideos[videoId]) === null || _embeddedVideos$video === void 0 || _embeddedVideos$video.pause();
|
|
257
|
+
});
|
|
258
|
+
this.isPlaying = false;
|
|
259
|
+
if (updateAutoplayPreference) {
|
|
260
|
+
this._setAutoplayPreference(false);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
kind: "method",
|
|
265
|
+
key: "playAllVideos",
|
|
266
|
+
value: function playAllVideos(updateAutoplayPreference = true) {
|
|
267
|
+
const {
|
|
268
|
+
embeddedVideos = {}
|
|
269
|
+
} = this;
|
|
270
|
+
Object.keys(embeddedVideos).forEach(videoId => {
|
|
271
|
+
var _embeddedVideos$video2;
|
|
272
|
+
(_embeddedVideos$video2 = embeddedVideos[videoId]) === null || _embeddedVideos$video2 === void 0 || _embeddedVideos$video2.play();
|
|
273
|
+
});
|
|
274
|
+
this.isPlaying = true;
|
|
275
|
+
this.playbackTriggered = true;
|
|
276
|
+
if (updateAutoplayPreference) {
|
|
277
|
+
this._setAutoplayPreference(true);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
kind: "method",
|
|
282
|
+
key: "getIsVideoPlaying",
|
|
283
|
+
value: function getIsVideoPlaying() {
|
|
284
|
+
var _iframe$contentWindow;
|
|
285
|
+
// GET BACK INTO THIS
|
|
286
|
+
const iframe = this.querySelector('iframe');
|
|
287
|
+
const playerContainer = iframe === null || iframe === void 0 || (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.document.querySelector('div.play-state');
|
|
288
|
+
return !(playerContainer == null);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* `true` to autoplay the videos.
|
|
293
|
+
*/
|
|
294
|
+
}, {
|
|
295
|
+
kind: "field",
|
|
296
|
+
decorators: [property({
|
|
297
|
+
type: Boolean,
|
|
298
|
+
attribute: 'auto-play'
|
|
299
|
+
})],
|
|
300
|
+
key: "autoPlay",
|
|
301
|
+
value() {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
kind: "field",
|
|
306
|
+
decorators: [property({
|
|
307
|
+
type: Boolean,
|
|
308
|
+
attribute: 'muted'
|
|
309
|
+
})],
|
|
310
|
+
key: "muted",
|
|
311
|
+
value() {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
kind: "field",
|
|
316
|
+
decorators: [property({
|
|
317
|
+
attribute: false
|
|
318
|
+
})],
|
|
319
|
+
key: "embeddedVideos",
|
|
320
|
+
value: void 0
|
|
321
|
+
}, {
|
|
322
|
+
kind: "field",
|
|
323
|
+
decorators: [property({
|
|
324
|
+
reflect: true,
|
|
325
|
+
attribute: 'caption'
|
|
326
|
+
})],
|
|
327
|
+
key: "caption",
|
|
328
|
+
value: void 0
|
|
329
|
+
}, {
|
|
330
|
+
kind: "field",
|
|
331
|
+
decorators: [property({
|
|
332
|
+
reflect: true,
|
|
333
|
+
attribute: 'video-description'
|
|
334
|
+
})],
|
|
335
|
+
key: "customVideoDescription",
|
|
336
|
+
value: void 0
|
|
337
|
+
}, {
|
|
338
|
+
kind: "field",
|
|
339
|
+
decorators: [property({
|
|
340
|
+
attribute: false
|
|
341
|
+
})],
|
|
342
|
+
key: "formatCaption",
|
|
343
|
+
value: void 0
|
|
344
|
+
}, {
|
|
345
|
+
kind: "field",
|
|
346
|
+
decorators: [property({
|
|
347
|
+
attribute: false
|
|
348
|
+
})],
|
|
349
|
+
key: "formatDuration",
|
|
350
|
+
value: void 0
|
|
351
|
+
}, {
|
|
352
|
+
kind: "field",
|
|
353
|
+
decorators: [property({
|
|
354
|
+
type: Boolean,
|
|
355
|
+
attribute: 'hide-caption'
|
|
356
|
+
})],
|
|
357
|
+
key: "hideCaption",
|
|
358
|
+
value() {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
kind: "field",
|
|
363
|
+
decorators: [property({
|
|
364
|
+
type: Boolean,
|
|
365
|
+
attribute: 'background-mode',
|
|
366
|
+
reflect: true
|
|
367
|
+
})],
|
|
368
|
+
key: "backgroundMode",
|
|
369
|
+
value() {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
}, {
|
|
373
|
+
kind: "field",
|
|
374
|
+
decorators: [property({
|
|
375
|
+
attribute: 'intersection-mode',
|
|
376
|
+
reflect: true,
|
|
377
|
+
type: Boolean
|
|
378
|
+
})],
|
|
379
|
+
key: "intersectionMode",
|
|
380
|
+
value() {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
}, {
|
|
384
|
+
kind: "field",
|
|
385
|
+
decorators: [property({
|
|
386
|
+
attribute: 'button-position',
|
|
387
|
+
reflect: true
|
|
388
|
+
})],
|
|
389
|
+
key: "buttonPosition",
|
|
390
|
+
value() {
|
|
391
|
+
return BUTTON_POSITION.BOTTOM_RIGHT;
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
kind: "field",
|
|
395
|
+
decorators: [state()],
|
|
396
|
+
key: "playbackTriggered",
|
|
397
|
+
value() {
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
kind: "field",
|
|
402
|
+
decorators: [property({
|
|
403
|
+
attribute: false
|
|
404
|
+
})],
|
|
405
|
+
key: "mediaData",
|
|
406
|
+
value: void 0
|
|
407
|
+
}, {
|
|
408
|
+
kind: "field",
|
|
409
|
+
decorators: [property({
|
|
410
|
+
attribute: 'video-id'
|
|
411
|
+
})],
|
|
412
|
+
key: "videoId",
|
|
413
|
+
value() {
|
|
414
|
+
return '';
|
|
415
|
+
}
|
|
416
|
+
}, {
|
|
417
|
+
kind: "field",
|
|
418
|
+
decorators: [property({
|
|
419
|
+
attribute: 'aspect-ratio'
|
|
420
|
+
})],
|
|
421
|
+
key: "aspectRatio",
|
|
422
|
+
value: void 0
|
|
423
|
+
}, {
|
|
424
|
+
kind: "field",
|
|
425
|
+
decorators: [property({
|
|
426
|
+
type: Boolean
|
|
427
|
+
})],
|
|
428
|
+
key: "isPlaying",
|
|
429
|
+
value() {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
kind: "field",
|
|
434
|
+
decorators: [property({
|
|
435
|
+
reflect: true,
|
|
436
|
+
attribute: 'playing-mode'
|
|
437
|
+
})],
|
|
438
|
+
key: "playingMode",
|
|
439
|
+
value() {
|
|
440
|
+
return VIDEO_PLAYER_PLAYING_MODE.INLINE;
|
|
441
|
+
}
|
|
442
|
+
}, {
|
|
443
|
+
kind: "field",
|
|
444
|
+
decorators: [property({
|
|
445
|
+
reflect: true,
|
|
446
|
+
attribute: 'thumbnail'
|
|
447
|
+
})],
|
|
448
|
+
key: "thumbnail",
|
|
449
|
+
value: void 0
|
|
450
|
+
}, {
|
|
451
|
+
kind: "field",
|
|
452
|
+
decorators: [property({
|
|
453
|
+
type: Number,
|
|
454
|
+
attribute: 'video-thumbnail-width'
|
|
455
|
+
})],
|
|
456
|
+
key: "videoThumbnailWidth",
|
|
457
|
+
value() {
|
|
458
|
+
return 3;
|
|
459
|
+
}
|
|
460
|
+
}, {
|
|
461
|
+
kind: "field",
|
|
462
|
+
decorators: [property({
|
|
463
|
+
type: Boolean
|
|
464
|
+
})],
|
|
465
|
+
key: "isRTL",
|
|
466
|
+
value() {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
}, {
|
|
470
|
+
kind: "method",
|
|
471
|
+
key: "connectedCallback",
|
|
472
|
+
value:
|
|
473
|
+
/**
|
|
474
|
+
* `true` load videos with sound muted.
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* The embedded Kaltura player element (that has APIs), keyed by the video ID.
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
* Optional custom video caption.
|
|
481
|
+
*/
|
|
482
|
+
/**
|
|
483
|
+
* Custom video description. This property should only be set when `playing-mode="lightbox"`.
|
|
484
|
+
*/
|
|
485
|
+
/**
|
|
486
|
+
* The formatter for the video caption, composed with the video name and the video duration.
|
|
487
|
+
* Should be changed upon the locale the UI is rendered with.
|
|
488
|
+
*/
|
|
489
|
+
/**
|
|
490
|
+
* The formatter for the video duration.
|
|
491
|
+
* Should be changed upon the locale the UI is rendered with.
|
|
492
|
+
*/
|
|
493
|
+
/**
|
|
494
|
+
* `true` to hide the caption.
|
|
495
|
+
*/
|
|
496
|
+
/**
|
|
497
|
+
* `true` to autoplay, mute, and hide player UI.
|
|
498
|
+
*/
|
|
499
|
+
/**
|
|
500
|
+
* Triggers playback on intersection with the viewport / carousel.
|
|
501
|
+
*/
|
|
502
|
+
/**
|
|
503
|
+
* The position of the toggle playback button.
|
|
504
|
+
*/
|
|
505
|
+
/**
|
|
506
|
+
* Track when we have triggered initial playback.
|
|
507
|
+
*/
|
|
508
|
+
/**
|
|
509
|
+
* The video data, keyed by the video ID.
|
|
510
|
+
*/
|
|
511
|
+
/**
|
|
512
|
+
* The video ID.
|
|
513
|
+
*/
|
|
514
|
+
/**
|
|
515
|
+
* The aspect ratio.
|
|
516
|
+
*/
|
|
517
|
+
/**
|
|
518
|
+
* The current playback state
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
* The video player's mode showing Inline or Lightbox.
|
|
522
|
+
*/
|
|
523
|
+
/**
|
|
524
|
+
* Optional custom video thumbnail
|
|
525
|
+
*/
|
|
526
|
+
/**
|
|
527
|
+
* The video thumbnail width.
|
|
528
|
+
*/
|
|
529
|
+
/**
|
|
530
|
+
* Determines if the direction is right-to-left
|
|
531
|
+
*/
|
|
532
|
+
/**
|
|
533
|
+
* Observe when the video container enters into view.
|
|
534
|
+
*/
|
|
535
|
+
/**
|
|
536
|
+
* Observe when the video container goes out of view.
|
|
537
|
+
*/
|
|
538
|
+
function connectedCallback() {
|
|
539
|
+
_superPropGet(C4DVideoPlayerComposite, "connectedCallback", this, 3)([]);
|
|
540
|
+
if (this.backgroundMode) {
|
|
541
|
+
this.hideCaption = true;
|
|
542
|
+
}
|
|
543
|
+
if (this.autoPlay || this.backgroundMode) {
|
|
544
|
+
const storedPreference = this._getAutoplayPreference();
|
|
545
|
+
if (storedPreference === null) {
|
|
546
|
+
this.isPlaying = !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
547
|
+
} else {
|
|
548
|
+
this.isPlaying = storedPreference;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (this.intersectionMode) {
|
|
552
|
+
this._cleanAndCreateObserverIntersection({
|
|
553
|
+
create: true
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// initializing the MutationObserver to observe for changes in the direction mode
|
|
558
|
+
this.observer = new MutationObserver(() => {
|
|
559
|
+
this.isRTL = this.dir === 'rtl' || getComputedStyle(this).direction === 'rtl';
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// observing the 'dir' attr in the root element
|
|
563
|
+
this.observer.observe(document.documentElement, {
|
|
564
|
+
attributes: true,
|
|
565
|
+
attributeFilter: ['dir']
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// Initial check for the direction
|
|
569
|
+
this.isRTL = this.dir === 'rtl' || getComputedStyle(this).direction === 'rtl';
|
|
570
|
+
}
|
|
571
|
+
}, {
|
|
572
|
+
kind: "method",
|
|
573
|
+
key: "disconnectedCallback",
|
|
574
|
+
value: function disconnectedCallback() {
|
|
575
|
+
_superPropGet(C4DVideoPlayerComposite, "disconnectedCallback", this, 3)([]);
|
|
576
|
+
this._cleanAndCreateObserverIntersection();
|
|
577
|
+
}
|
|
578
|
+
}, {
|
|
579
|
+
kind: "method",
|
|
580
|
+
key: "updated",
|
|
581
|
+
value: function updated(changedProperties) {
|
|
582
|
+
if (changedProperties.has('videoId')) {
|
|
583
|
+
const {
|
|
584
|
+
autoPlay,
|
|
585
|
+
videoId,
|
|
586
|
+
backgroundMode
|
|
587
|
+
} = this;
|
|
588
|
+
this._activateEmbeddedVideo(videoId);
|
|
589
|
+
if (videoId) {
|
|
590
|
+
var _this$_loadVideoData;
|
|
591
|
+
(_this$_loadVideoData = this._loadVideoData) === null || _this$_loadVideoData === void 0 || _this$_loadVideoData.call(this, videoId);
|
|
592
|
+
if (autoPlay || backgroundMode) {
|
|
593
|
+
var _this$_embedMedia4;
|
|
594
|
+
(_this$_embedMedia4 = this._embedMedia) === null || _this$_embedMedia4 === void 0 || _this$_embedMedia4.call(this, videoId);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}, {
|
|
600
|
+
kind: "method",
|
|
601
|
+
key: "renderLightDOM",
|
|
602
|
+
value: function renderLightDOM() {
|
|
603
|
+
var _document$querySelect;
|
|
604
|
+
// setting the direction mode of the video player.
|
|
605
|
+
(_document$querySelect = document.querySelector('.c4d--video-player__video')) === null || _document$querySelect === void 0 || _document$querySelect.setAttribute('dir-mode', `${this.isRTL ? 'rtl' : 'ltr'}`);
|
|
606
|
+
const {
|
|
607
|
+
aspectRatio,
|
|
608
|
+
formatCaption,
|
|
609
|
+
formatDuration,
|
|
610
|
+
hideCaption,
|
|
611
|
+
caption,
|
|
612
|
+
customVideoDescription,
|
|
613
|
+
mediaData = {},
|
|
614
|
+
videoId,
|
|
615
|
+
videoThumbnailWidth,
|
|
616
|
+
thumbnail,
|
|
617
|
+
playingMode,
|
|
618
|
+
buttonPosition
|
|
619
|
+
} = this;
|
|
620
|
+
const {
|
|
621
|
+
[videoId]: currentVideoData = {}
|
|
622
|
+
} = mediaData;
|
|
623
|
+
const {
|
|
624
|
+
duration,
|
|
625
|
+
name
|
|
626
|
+
} = currentVideoData;
|
|
627
|
+
const thumbnailUrl = thumbnail || KalturaPlayerAPI.getThumbnailUrl({
|
|
628
|
+
mediaId: videoId,
|
|
629
|
+
width: videoThumbnailWidth
|
|
630
|
+
});
|
|
631
|
+
return html(_t || (_t = _`
|
|
632
|
+
<c4d-video-player-v7
|
|
633
|
+
part="video-player"
|
|
634
|
+
duration="${0}"
|
|
635
|
+
?hide-caption=${0}
|
|
636
|
+
name="${0}"
|
|
637
|
+
video-description="${0}"
|
|
638
|
+
thumbnail-url="${0}"
|
|
639
|
+
video-id="${0}"
|
|
640
|
+
aspect-ratio="${0}"
|
|
641
|
+
playing-mode="${0}"
|
|
642
|
+
content-state="${0}"
|
|
643
|
+
button-position="${0}"
|
|
644
|
+
.formatCaption="${0}"
|
|
645
|
+
.formatDuration="${0}"
|
|
646
|
+
.isPlaying=${0}>
|
|
647
|
+
</c4d-video-player-v7>
|
|
648
|
+
`), ifNonEmpty(duration), hideCaption, ifNonEmpty(caption || name), ifNonEmpty(customVideoDescription), ifNonEmpty(thumbnailUrl), ifNonEmpty(videoId), ifNonEmpty(aspectRatio), ifNonEmpty(playingMode), this.playbackTriggered ? VIDEO_PLAYER_CONTENT_STATE.VIDEO : VIDEO_PLAYER_CONTENT_STATE.THUMBNAIL, buttonPosition, ifNonEmpty(formatCaption), ifNonEmpty(formatDuration), this.isPlaying);
|
|
649
|
+
}
|
|
650
|
+
}, {
|
|
651
|
+
kind: "method",
|
|
652
|
+
key: "render",
|
|
653
|
+
value: function render() {
|
|
654
|
+
return html(_t2 || (_t2 = _` <slot></slot> `));
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* A selector selecting the video player component.
|
|
659
|
+
*/
|
|
660
|
+
}, {
|
|
661
|
+
kind: "get",
|
|
662
|
+
static: true,
|
|
663
|
+
key: "selectorVideoPlayer",
|
|
664
|
+
value: function () {
|
|
665
|
+
return `${c4dPrefix}-video-player-v7`;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* The name of the custom event fired after video content state is changed upon a user gesture.
|
|
670
|
+
*/
|
|
671
|
+
}, {
|
|
672
|
+
kind: "get",
|
|
673
|
+
static: true,
|
|
674
|
+
key: "eventContentStateChange",
|
|
675
|
+
value: function () {
|
|
676
|
+
return `${c4dPrefix}-video-player-content-state-changed`;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* The name of the custom event fired requesting playback state change.
|
|
681
|
+
*/
|
|
682
|
+
}, {
|
|
683
|
+
kind: "get",
|
|
684
|
+
static: true,
|
|
685
|
+
key: "eventPlaybackStateChange",
|
|
686
|
+
value: function () {
|
|
687
|
+
return `${c4dPrefix}-video-player-playback-state-changed`;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* The name of the custom event fired requesting to toggle playback.
|
|
692
|
+
*/
|
|
693
|
+
}, {
|
|
694
|
+
kind: "get",
|
|
695
|
+
static: true,
|
|
696
|
+
key: "eventTogglePlayback",
|
|
697
|
+
value: function () {
|
|
698
|
+
return `${c4dPrefix}-video-player-toggle-playback`;
|
|
699
|
+
}
|
|
700
|
+
}]
|
|
701
|
+
};
|
|
702
|
+
}, HybridRenderMixin(HostListenerMixin(LitElement)));
|
|
703
|
+
/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */
|
|
704
|
+
export default C4DVideoPlayerComposite;
|
|
705
|
+
//# sourceMappingURL=video-player-composite.js.map
|