@carbon/ibmdotcom-web-components 2.24.0 → 2.25.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 +13 -9
- package/dist/dotcom-shell.js +1 -1
- package/dist/dotcom-shell.min.js +1 -1
- package/dist/ibmdotcom-web-components-dotcom-shell.js +1 -1
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +1 -1
- package/dist/{index-e763be5b.js → index-1dfaa907.js} +10 -4
- package/dist/{index-e9e0dc0d.js → index-8e5904a0.js} +3 -3
- package/dist/{left-nav-menu-a2e98b5a.js → left-nav-menu-08b77355.js} +1 -1
- package/dist/{left-nav-menu-category-heading-404801f6.js → left-nav-menu-category-heading-1874e85f.js} +1 -1
- package/dist/{left-nav-menu-category-heading-70403118.js → left-nav-menu-category-heading-907c5870.js} +1 -1
- package/dist/{left-nav-menu-353311b3.js → left-nav-menu-ee66480f.js} +1 -1
- package/dist/{left-nav-menu-item-1930f6e3.js → left-nav-menu-item-463c0a47.js} +1 -1
- package/dist/{left-nav-menu-item-1c788c22.js → left-nav-menu-item-62b3aeb4.js} +1 -1
- package/dist/{left-nav-menu-section-a5aacf10.js → left-nav-menu-section-36fa5f37.js} +1 -1
- package/dist/{left-nav-menu-section-ce8644e6.js → left-nav-menu-section-620f3e39.js} +1 -1
- package/dist/{left-nav-overlay-5abc69f8.js → left-nav-overlay-11083652.js} +1 -1
- package/dist/{left-nav-overlay-5e37dc8f.js → left-nav-overlay-4aa89969.js} +1 -1
- package/dist/{megamenu-category-group-a9045c01.js → megamenu-category-group-38ebe02a.js} +1 -1
- package/dist/{megamenu-category-group-921d7e31.js → megamenu-category-group-768aa48a.js} +1 -1
- package/dist/{megamenu-category-group-copy-d173c916.js → megamenu-category-group-copy-0036630c.js} +1 -1
- package/dist/{megamenu-category-group-copy-dc085be6.js → megamenu-category-group-copy-0770e2d1.js} +1 -1
- package/dist/{megamenu-category-heading-90e67482.js → megamenu-category-heading-25325ce1.js} +1 -1
- package/dist/{megamenu-category-heading-f07f73c0.js → megamenu-category-heading-5fae5a7f.js} +1 -1
- package/dist/{megamenu-category-link-e0c9fc7a.js → megamenu-category-link-3a79d2ea.js} +1 -1
- package/dist/{megamenu-category-link-dcd41f45.js → megamenu-category-link-d1712222.js} +1 -1
- package/dist/{megamenu-category-link-group-6ff3a30d.js → megamenu-category-link-group-ba6e3528.js} +1 -1
- package/dist/{megamenu-category-link-group-1a30ccc7.js → megamenu-category-link-group-fe0164c9.js} +1 -1
- package/dist/{megamenu-left-navigation-fcd7c3f0.js → megamenu-left-navigation-29fdbefc.js} +1 -1
- package/dist/{megamenu-left-navigation-4b810f29.js → megamenu-left-navigation-dba059eb.js} +1 -1
- package/dist/{megamenu-overlay-69613b97.js → megamenu-overlay-6fcf6e91.js} +1 -1
- package/dist/{megamenu-overlay-e179976a.js → megamenu-overlay-899719ba.js} +1 -1
- package/dist/{megamenu-tab-4e651fc9.js → megamenu-tab-1835d1a2.js} +1 -1
- package/dist/{megamenu-tab-fa23e87d.js → megamenu-tab-1a79a248.js} +1 -1
- package/es/components/background-media/background-media.css.js +1 -1
- package/es/components/background-media/background-media.d.ts +7 -1
- package/es/components/background-media/background-media.js +29 -1
- package/es/components/background-media/background-media.js.map +1 -1
- package/es/components/background-media/defs.d.ts +5 -1
- package/es/components/background-media/defs.js +2 -1
- package/es/components/background-media/defs.js.map +1 -1
- package/es/components/card-section-offset/card-section-offset.css.js +1 -1
- package/es/components/cta/video-cta-container.d.ts +1 -0
- package/es/components/lightbox-media-viewer/lightbox-video-player-container.d.ts +1 -0
- package/es/components/video-player/video-player-container.d.ts +3 -1
- package/es/components/video-player/video-player-container.js +276 -195
- package/es/components/video-player/video-player-container.js.map +1 -1
- package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayer/KalturaPlayer.js +7 -1
- package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/lib/components/background-media/defs.js +2 -1
- package/lib/components/background-media/defs.js.map +1 -1
- package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayer/KalturaPlayer.js +7 -1
- package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/package.json +5 -5
|
@@ -375,6 +375,7 @@ declare const C4DVideoCTAContainer_base: {
|
|
|
375
375
|
_requestsEmbedVideo: {
|
|
376
376
|
[videoId: string]: Promise<any>;
|
|
377
377
|
};
|
|
378
|
+
customVideoName: string;
|
|
378
379
|
_setRequestEmbedVideoInProgress(videoId: string, request: Promise<any>): void;
|
|
379
380
|
_setErrorRequestEmbedVideo(videoId: string, error: Error): void;
|
|
380
381
|
_setEmbeddedVideo(videoId: string, kWidget: any): void;
|
|
@@ -350,6 +350,7 @@ declare const C4DLightboxVideoPlayerContainer_base: {
|
|
|
350
350
|
_requestsEmbedVideo: {
|
|
351
351
|
[videoId: string]: Promise<any>;
|
|
352
352
|
};
|
|
353
|
+
customVideoName: string;
|
|
353
354
|
_setRequestEmbedVideoInProgress(videoId: string, request: Promise<any>): void;
|
|
354
355
|
_setErrorRequestEmbedVideo(videoId: string, error: Error): void;
|
|
355
356
|
_setEmbeddedVideo(videoId: string, kWidget: any): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020,
|
|
4
|
+
* Copyright IBM Corp. 2020, 2025
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -68,6 +68,7 @@ export declare const C4DVideoPlayerContainerMixin: <T extends Constructor<HTMLEl
|
|
|
68
68
|
_requestsEmbedVideo: {
|
|
69
69
|
[videoId: string]: Promise<any>;
|
|
70
70
|
};
|
|
71
|
+
customVideoName: string;
|
|
71
72
|
/**
|
|
72
73
|
* Sets the state that the API call for embedding the video for the given video ID is in progress.
|
|
73
74
|
*
|
|
@@ -806,6 +807,7 @@ declare const C4DVideoPlayerContainer_base: {
|
|
|
806
807
|
_requestsEmbedVideo: {
|
|
807
808
|
[videoId: string]: Promise<any>;
|
|
808
809
|
};
|
|
810
|
+
customVideoName: string;
|
|
809
811
|
/**
|
|
810
812
|
* Sets the state that the API call for embedding the video for the given video ID is in progress.
|
|
811
813
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _decorate from "@babel/runtime/helpers/esm/decorate";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _decorate from "@babel/runtime/helpers/esm/decorate";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
7
|
*
|
|
8
|
-
* Copyright IBM Corp. 2020,
|
|
8
|
+
* Copyright IBM Corp. 2020, 2025
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,6 +13,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
13
|
|
|
14
14
|
import { bindActionCreators } from 'redux';
|
|
15
15
|
import 'lit';
|
|
16
|
+
import { property } from 'lit/decorators.js';
|
|
16
17
|
import KalturaPlayerAPI from '@carbon/ibmdotcom-services/es/services/KalturaPlayer/KalturaPlayer.js';
|
|
17
18
|
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
|
|
18
19
|
import store from '../../internal/vendor/@carbon/ibmdotcom-services-store/store.js';
|
|
@@ -68,204 +69,284 @@ export const C4DVideoPlayerContainerMixin = Base => {
|
|
|
68
69
|
/**
|
|
69
70
|
* A mix-in class that sets up and cleans up event listeners defined by `@HostListener` decorator.
|
|
70
71
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* @protected
|
|
86
|
-
*/
|
|
87
|
-
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
88
|
-
_defineProperty(this, "_requestsEmbedVideo", {});
|
|
89
|
-
/**
|
|
90
|
-
* Sends the API call for embedding video for the given video ID, and tracks the progress and the error of the REST call.
|
|
91
|
-
*
|
|
92
|
-
* @param videoId The video ID.
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
_defineProperty(this, "_embedMedia", async function (videoId) {
|
|
96
|
-
const {
|
|
97
|
-
_requestsEmbedVideo: requestsEmbedVideo
|
|
98
|
-
} = _this;
|
|
99
|
-
const requestEmbedVideo = requestsEmbedVideo[videoId];
|
|
100
|
-
if (requestEmbedVideo) {
|
|
101
|
-
return requestEmbedVideo;
|
|
72
|
+
let C4DVideoPlayerContainerMixinImpl = _decorate(null, function (_initialize, _StableSelectorMixin) {
|
|
73
|
+
class C4DVideoPlayerContainerMixinImpl extends _StableSelectorMixin {
|
|
74
|
+
constructor(...args) {
|
|
75
|
+
super(...args);
|
|
76
|
+
_initialize(this);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
F: C4DVideoPlayerContainerMixinImpl,
|
|
81
|
+
d: [{
|
|
82
|
+
kind: "field",
|
|
83
|
+
key: "_requestsEmbedVideo",
|
|
84
|
+
value() {
|
|
85
|
+
return {};
|
|
102
86
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
}, {
|
|
88
|
+
kind: "field",
|
|
89
|
+
decorators: [property({
|
|
90
|
+
type: String,
|
|
91
|
+
attribute: 'customvideoname'
|
|
92
|
+
})],
|
|
93
|
+
key: "customVideoName",
|
|
94
|
+
value() {
|
|
95
|
+
return '';
|
|
109
96
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* @param videoId The video ID.
|
|
118
|
-
* @param request The promise of the API call for embedding the video of the given video ID that is in progress.
|
|
119
|
-
* @private
|
|
120
|
-
*/
|
|
121
|
-
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
122
|
-
_setRequestEmbedVideoInProgress(videoId, request) {
|
|
123
|
-
const {
|
|
124
|
-
_requestsEmbedVideo: oldRequestsEmbedVideo
|
|
125
|
-
} = this;
|
|
126
|
-
this._requestsEmbedVideo = _objectSpread(_objectSpread({}, oldRequestsEmbedVideo), {}, {
|
|
127
|
-
[videoId]: request
|
|
128
|
-
});
|
|
129
|
-
}
|
|
97
|
+
}, {
|
|
98
|
+
kind: "method",
|
|
99
|
+
key: "_setRequestEmbedVideoInProgress",
|
|
100
|
+
value:
|
|
101
|
+
/**
|
|
102
|
+
* The video player.
|
|
103
|
+
*/
|
|
130
104
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
* @param videoId The video ID.
|
|
135
|
-
* @param error An error from the API call for embedding the video of the given video ID.
|
|
136
|
-
* @private
|
|
137
|
-
*/
|
|
138
|
-
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
139
|
-
_setErrorRequestEmbedVideo(videoId, error) {
|
|
140
|
-
this._setRequestEmbedVideoInProgress(videoId, Promise.reject(error));
|
|
141
|
-
}
|
|
105
|
+
/**
|
|
106
|
+
* The embedded Kaltura player element (that has `.sendNotification()`, etc. APIs), keyed by the video ID.
|
|
107
|
+
*/
|
|
142
108
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
109
|
+
/**
|
|
110
|
+
* The request for the embedded Kaltura player element (that has `.sendNotification()`, etc. APIs), keyed by the video ID.
|
|
111
|
+
*
|
|
112
|
+
* @protected
|
|
113
|
+
*/
|
|
114
|
+
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Sets the state that the API call for embedding the video for the given video ID is in progress.
|
|
118
|
+
*
|
|
119
|
+
* @param videoId The video ID.
|
|
120
|
+
* @param request The promise of the API call for embedding the video of the given video ID that is in progress.
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
124
|
+
function _setRequestEmbedVideoInProgress(videoId, request) {
|
|
125
|
+
const {
|
|
126
|
+
_requestsEmbedVideo: oldRequestsEmbedVideo
|
|
127
|
+
} = this;
|
|
128
|
+
this._requestsEmbedVideo = _objectSpread(_objectSpread({}, oldRequestsEmbedVideo), {}, {
|
|
129
|
+
[videoId]: request
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Set the state that the API call for embedding the video for the given video ID is failed.
|
|
135
|
+
*
|
|
136
|
+
* @param videoId The video ID.
|
|
137
|
+
* @param error An error from the API call for embedding the video of the given video ID.
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
141
|
+
}, {
|
|
142
|
+
kind: "method",
|
|
143
|
+
key: "_setErrorRequestEmbedVideo",
|
|
144
|
+
value: function _setErrorRequestEmbedVideo(videoId, error) {
|
|
145
|
+
this._setRequestEmbedVideoInProgress(videoId, Promise.reject(error));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Sets the given embedded Kaltura player element (that has `.sendNotification()`, etc. APIs) for the given video ID.
|
|
150
|
+
*
|
|
151
|
+
* @param videoId The video ID.
|
|
152
|
+
* @param kWidget The embedded Kaltura player element (that has `.sendNotification()`, etc. APIs).
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
156
|
+
}, {
|
|
157
|
+
kind: "method",
|
|
158
|
+
key: "_setEmbeddedVideo",
|
|
159
|
+
value: function _setEmbeddedVideo(videoId, kWidget) {
|
|
160
|
+
this._setRequestEmbedVideoInProgress(videoId, Promise.resolve(kWidget));
|
|
161
|
+
const {
|
|
162
|
+
embeddedVideos: oldEmbeddedVideos
|
|
163
|
+
} = this;
|
|
164
|
+
this.embeddedVideos = _objectSpread(_objectSpread({}, oldEmbeddedVideos), {}, {
|
|
165
|
+
[videoId]: kWidget
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
kind: "method",
|
|
170
|
+
key: "_setAutoplayPreference",
|
|
171
|
+
value: function _setAutoplayPreference(preference) {
|
|
172
|
+
const updatedValue = preference ? '1' : '0';
|
|
173
|
+
localStorage.setItem(`${this.prefersAutoplayStorageKey}`, updatedValue);
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
kind: "method",
|
|
177
|
+
key: "_getAutoplayPreference",
|
|
178
|
+
value: function _getAutoplayPreference() {
|
|
179
|
+
const storedValue = localStorage.getItem(`${this.prefersAutoplayStorageKey}`);
|
|
180
|
+
if (storedValue === null) {
|
|
181
|
+
return !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
182
|
+
} else {
|
|
183
|
+
return Boolean(parseInt(storedValue, 10));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
kind: "method",
|
|
188
|
+
key: "_getPlayerOptions",
|
|
189
|
+
value: function _getPlayerOptions() {
|
|
190
|
+
const {
|
|
191
|
+
backgroundMode,
|
|
192
|
+
intersectionMode,
|
|
193
|
+
autoPlay,
|
|
194
|
+
muted
|
|
195
|
+
} = this;
|
|
196
|
+
/**
|
|
197
|
+
* The overwritten media title.
|
|
198
|
+
*
|
|
199
|
+
* Quick and dirty turn around as C4DVideoPlayerComposite uses caption
|
|
200
|
+
* and C4DLightboxVideoPlayer uses customVideoName and none are
|
|
201
|
+
* part of the same type
|
|
202
|
+
*
|
|
203
|
+
* <c4d-video-player-container customVideoName="overwritten media title here">...
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
const mediaTitle = (this === null || this === void 0 ? void 0 : this['customVideoName']) || (this === null || this === void 0 ? void 0 : this['caption']);
|
|
207
|
+
let playerOptions = {};
|
|
208
|
+
const autoplayPreference = this._getAutoplayPreference();
|
|
209
|
+
switch (true) {
|
|
210
|
+
case autoPlay:
|
|
211
|
+
playerOptions = {
|
|
212
|
+
autoMute: muted,
|
|
213
|
+
autoPlay: autoplayPreference
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
case backgroundMode || intersectionMode:
|
|
217
|
+
playerOptions = {
|
|
218
|
+
'topBarContainer.plugin': false,
|
|
219
|
+
'controlBarContainer.plugin': false,
|
|
220
|
+
'largePlayBtn.plugin': false,
|
|
221
|
+
'loadingSpinner.plugin': false,
|
|
222
|
+
'unMuteOverlayButton.plugin': false,
|
|
223
|
+
'EmbedPlayer.DisableVideoTagSupport': false,
|
|
224
|
+
loop: true,
|
|
225
|
+
autoMute: true,
|
|
226
|
+
autoPlay: autoplayPreference,
|
|
227
|
+
// Turn off CTA's including mid-roll card and end cards.
|
|
228
|
+
'ibm.callToActions': false,
|
|
229
|
+
// Turn off captions display, background/ambient videos have no
|
|
230
|
+
// audio.
|
|
231
|
+
closedCaptions: {
|
|
232
|
+
plugin: false
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
playerOptions = {
|
|
238
|
+
autoMute: muted
|
|
239
|
+
};
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
if (mediaTitle) {
|
|
243
|
+
playerOptions = _objectSpread(_objectSpread({}, playerOptions), {
|
|
244
|
+
titleLabel: {
|
|
245
|
+
plugin: true,
|
|
246
|
+
align: 'left',
|
|
247
|
+
text: mediaTitle
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return playerOptions;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Sets up and sends the API call for embedding video for the given video ID.
|
|
256
|
+
*
|
|
257
|
+
* @param videoId The video ID.
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
261
|
+
}, {
|
|
262
|
+
kind: "method",
|
|
263
|
+
key: "_embedVideoImpl",
|
|
264
|
+
value: async function _embedVideoImpl(videoId) {
|
|
265
|
+
var _getElementById;
|
|
266
|
+
const doc = Object.prototype.hasOwnProperty.call(this, 'getRootNode') ? this.getRootNode() : this.ownerDocument;
|
|
267
|
+
// Given Kaltura replaces the `<div>` here with `<iframe>` with the video player,
|
|
268
|
+
// rendering this `<div>` in `renderLightDOM()` will cause the video player being clobbered
|
|
269
|
+
const playerId = Math.random().toString(36).slice(2);
|
|
270
|
+
const div = document.createElement('div');
|
|
271
|
+
div.id = playerId;
|
|
272
|
+
div.className = `${c4dPrefix}--video-player__video`;
|
|
273
|
+
const {
|
|
274
|
+
_videoPlayer: videoPlayer
|
|
275
|
+
} = this;
|
|
276
|
+
if (!videoPlayer) {
|
|
277
|
+
throw new TypeError('Cannot find the video player component to put the video content into.');
|
|
278
|
+
}
|
|
279
|
+
videoPlayer.appendChild(div);
|
|
280
|
+
const embedVideoHandle = await KalturaPlayerAPI.embedMedia(videoId, playerId, this._getPlayerOptions());
|
|
281
|
+
const {
|
|
282
|
+
width,
|
|
283
|
+
height
|
|
284
|
+
} = await KalturaPlayerAPI.api(videoId);
|
|
285
|
+
videoPlayer.style.setProperty('--native-file-width', `${width}px`);
|
|
286
|
+
videoPlayer.style.setProperty('--native-file-height', `${height}px`);
|
|
287
|
+
videoPlayer.style.setProperty('--native-file-aspect-ratio', `${width} / ${height}`);
|
|
288
|
+
doc.getElementById(playerId).dataset.videoId = videoId;
|
|
289
|
+
const videoEmbed = (_getElementById = doc.getElementById(playerId)) === null || _getElementById === void 0 ? void 0 : _getElementById.firstElementChild;
|
|
290
|
+
if (videoEmbed) {
|
|
291
|
+
videoEmbed.focus();
|
|
292
|
+
}
|
|
293
|
+
return embedVideoHandle.kWidget();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Sends the API call for embedding video for the given video ID, and tracks the progress and the error of the REST call.
|
|
298
|
+
*
|
|
299
|
+
* @param videoId The video ID.
|
|
300
|
+
* @internal
|
|
301
|
+
*/
|
|
302
|
+
}, {
|
|
303
|
+
kind: "field",
|
|
304
|
+
key: "_embedMedia",
|
|
305
|
+
value() {
|
|
306
|
+
return async videoId => {
|
|
307
|
+
const {
|
|
308
|
+
_requestsEmbedVideo: requestsEmbedVideo
|
|
309
|
+
} = this;
|
|
310
|
+
const requestEmbedVideo = requestsEmbedVideo[videoId];
|
|
311
|
+
if (requestEmbedVideo) {
|
|
312
|
+
return requestEmbedVideo;
|
|
205
313
|
}
|
|
314
|
+
const promiseEmbedVideo = this._embedVideoImpl(videoId);
|
|
315
|
+
this._setRequestEmbedVideoInProgress(videoId, promiseEmbedVideo);
|
|
316
|
+
try {
|
|
317
|
+
this._setEmbeddedVideo(videoId, await promiseEmbedVideo);
|
|
318
|
+
} catch (error) {
|
|
319
|
+
this._setErrorRequestEmbedVideo(videoId, error);
|
|
320
|
+
}
|
|
321
|
+
return promiseEmbedVideo;
|
|
206
322
|
};
|
|
207
|
-
break;
|
|
208
|
-
default:
|
|
209
|
-
playerOptions = {
|
|
210
|
-
autoMute: muted
|
|
211
|
-
};
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
return playerOptions;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Sets up and sends the API call for embedding video for the given video ID.
|
|
219
|
-
*
|
|
220
|
-
* @param videoId The video ID.
|
|
221
|
-
* @private
|
|
222
|
-
*/
|
|
223
|
-
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
|
|
224
|
-
async _embedVideoImpl(videoId) {
|
|
225
|
-
var _getElementById;
|
|
226
|
-
const doc = Object.prototype.hasOwnProperty.call(this, 'getRootNode') ? this.getRootNode() : this.ownerDocument;
|
|
227
|
-
// Given Kaltura replaces the `<div>` here with `<iframe>` with the video player,
|
|
228
|
-
// rendering this `<div>` in `renderLightDOM()` will cause the video player being clobbered
|
|
229
|
-
const playerId = Math.random().toString(36).slice(2);
|
|
230
|
-
const div = document.createElement('div');
|
|
231
|
-
div.id = playerId;
|
|
232
|
-
div.className = `${c4dPrefix}--video-player__video`;
|
|
233
|
-
const {
|
|
234
|
-
_videoPlayer: videoPlayer
|
|
235
|
-
} = this;
|
|
236
|
-
if (!videoPlayer) {
|
|
237
|
-
throw new TypeError('Cannot find the video player component to put the video content into.');
|
|
238
|
-
}
|
|
239
|
-
videoPlayer.appendChild(div);
|
|
240
|
-
const embedVideoHandle = await KalturaPlayerAPI.embedMedia(videoId, playerId, this._getPlayerOptions());
|
|
241
|
-
const {
|
|
242
|
-
width,
|
|
243
|
-
height
|
|
244
|
-
} = await KalturaPlayerAPI.api(videoId);
|
|
245
|
-
videoPlayer.style.setProperty('--native-file-width', `${width}px`);
|
|
246
|
-
videoPlayer.style.setProperty('--native-file-height', `${height}px`);
|
|
247
|
-
videoPlayer.style.setProperty('--native-file-aspect-ratio', `${width} / ${height}`);
|
|
248
|
-
doc.getElementById(playerId).dataset.videoId = videoId;
|
|
249
|
-
const videoEmbed = (_getElementById = doc.getElementById(playerId)) === null || _getElementById === void 0 ? void 0 : _getElementById.firstElementChild;
|
|
250
|
-
if (videoEmbed) {
|
|
251
|
-
videoEmbed.focus();
|
|
252
|
-
}
|
|
253
|
-
return embedVideoHandle.kWidget();
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Calls the data-* attribute transpose function to target `c4d-video-player`'s button element.
|
|
257
|
-
*/
|
|
258
|
-
firstUpdated() {
|
|
259
|
-
window.requestAnimationFrame(() => {
|
|
260
|
-
var _this$querySelector;
|
|
261
|
-
const button = (_this$querySelector = this.querySelector('c4d-video-player')) === null || _this$querySelector === void 0 || (_this$querySelector = _this$querySelector.shadowRoot) === null || _this$querySelector === void 0 ? void 0 : _this$querySelector.querySelector('button');
|
|
262
|
-
if (!this.getAttribute('href') && this.getAttribute('video-id')) {
|
|
263
|
-
this.setAttribute('href', `https://mediacenter.ibm.com/id/${this.getAttribute('video-id')}`);
|
|
264
323
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
324
|
+
}, {
|
|
325
|
+
kind: "method",
|
|
326
|
+
key: "firstUpdated",
|
|
327
|
+
value:
|
|
328
|
+
/**
|
|
329
|
+
* Calls the data-* attribute transpose function to target `c4d-video-player`'s button element.
|
|
330
|
+
*/
|
|
331
|
+
function firstUpdated() {
|
|
332
|
+
window.requestAnimationFrame(() => {
|
|
333
|
+
var _this$querySelector;
|
|
334
|
+
const button = (_this$querySelector = this.querySelector('c4d-video-player')) === null || _this$querySelector === void 0 || (_this$querySelector = _this$querySelector.shadowRoot) === null || _this$querySelector === void 0 ? void 0 : _this$querySelector.querySelector('button');
|
|
335
|
+
if (!this.getAttribute('href') && this.getAttribute('video-id')) {
|
|
336
|
+
this.setAttribute('href', `https://mediacenter.ibm.com/id/${this.getAttribute('video-id')}`);
|
|
337
|
+
}
|
|
338
|
+
this.transposeAttributes(button, ['href']);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}, {
|
|
342
|
+
kind: "field",
|
|
343
|
+
key: "prefersAutoplayStorageKey",
|
|
344
|
+
value() {
|
|
345
|
+
return `${c4dPrefix}-background-video-prefers-autoplay`;
|
|
346
|
+
}
|
|
347
|
+
}]
|
|
348
|
+
};
|
|
349
|
+
}, StableSelectorMixin(Base));
|
|
269
350
|
return C4DVideoPlayerContainerMixinImpl;
|
|
270
351
|
};
|
|
271
352
|
|
|
@@ -274,11 +355,11 @@ export const C4DVideoPlayerContainerMixin = Base => {
|
|
|
274
355
|
*
|
|
275
356
|
* @element c4d-video-player-container
|
|
276
357
|
*/
|
|
277
|
-
let C4DVideoPlayerContainer = _decorate([customElement(`${c4dPrefix}-video-player-container`)], function (
|
|
358
|
+
let C4DVideoPlayerContainer = _decorate([customElement(`${c4dPrefix}-video-player-container`)], function (_initialize2, _ConnectMixin) {
|
|
278
359
|
class C4DVideoPlayerContainer extends _ConnectMixin {
|
|
279
360
|
constructor(...args) {
|
|
280
361
|
super(...args);
|
|
281
|
-
|
|
362
|
+
_initialize2(this);
|
|
282
363
|
}
|
|
283
364
|
}
|
|
284
365
|
return {
|