@jaaq/jaaq-sdk-js 1.1.0 → 1.1.1-dev-40aa96f-20251218
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/README.md +77 -38
- package/dist/embed/embed-collection.html +40 -1
- package/dist/embed/embed.html +55 -1
- package/dist/ui/index.cjs +75 -2
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.mjs +75 -2
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/jaaq-ui-bundled.min.js +1 -1
- package/dist/ui/jaaq-ui-bundled.min.js.map +1 -1
- package/dist/ui/jaaq-ui.min.js +2 -2
- package/dist/ui/jaaq-ui.min.js.map +1 -1
- package/dist/ui/react/index.cjs +56 -4
- package/dist/ui/react/index.cjs.map +1 -1
- package/dist/ui/react/index.d.ts +6 -0
- package/dist/ui/react/index.mjs +56 -4
- package/dist/ui/react/index.mjs.map +1 -1
- package/dist/ui/react/jaaq-ui-react.min.js +1 -1
- package/dist/ui/react/jaaq-ui-react.min.js.map +1 -1
- package/dist/ui/vanilla/index.cjs +75 -2
- package/dist/ui/vanilla/index.cjs.map +1 -1
- package/dist/ui/vanilla/index.d.ts +6 -0
- package/dist/ui/vanilla/index.mjs +75 -2
- package/dist/ui/vanilla/index.mjs.map +1 -1
- package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js +1 -1
- package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js.map +1 -1
- package/dist/ui/vanilla/jaaq-vanilla.min.js +2 -2
- package/dist/ui/vanilla/jaaq-vanilla.min.js.map +1 -1
- package/dist/ui/webcomponents/index.cjs +48 -2
- package/dist/ui/webcomponents/index.cjs.map +1 -1
- package/dist/ui/webcomponents/index.mjs +48 -2
- package/dist/ui/webcomponents/index.mjs.map +1 -1
- package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js +2 -2
- package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js.map +1 -1
- package/dist/ui/webcomponents/jaaq-webcomponents.min.js +1 -1
- package/dist/ui/webcomponents/jaaq-webcomponents.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,6 +198,7 @@ Declarative usage:
|
|
|
198
198
|
autoplay="false"
|
|
199
199
|
show-arrows="true"
|
|
200
200
|
show-dots="true"
|
|
201
|
+
video-settings='{"controls":true,"showLogo":false,"showTitle":true,"showAuthor":true,"showDescription":false,"showCaptions":true}'
|
|
201
202
|
></jaaq-collection-player>
|
|
202
203
|
```
|
|
203
204
|
|
|
@@ -210,6 +211,17 @@ const player = document.createElement('jaaq-collection-player');
|
|
|
210
211
|
player.setAttribute('collection-id', 'your-collection-id');
|
|
211
212
|
player.setAttribute('api-key', 'your-api-key');
|
|
212
213
|
player.setAttribute('client-id', 'your-client-id');
|
|
214
|
+
player.setAttribute(
|
|
215
|
+
'video-settings',
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
controls: true,
|
|
218
|
+
showLogo: false,
|
|
219
|
+
showTitle: true,
|
|
220
|
+
showAuthor: true,
|
|
221
|
+
showDescription: false,
|
|
222
|
+
showCaptions: true,
|
|
223
|
+
}),
|
|
224
|
+
);
|
|
213
225
|
|
|
214
226
|
player.addEventListener('jaaq:collection:loaded', (e) => {
|
|
215
227
|
console.log(e.detail);
|
|
@@ -220,16 +232,17 @@ document.body.appendChild(player);
|
|
|
220
232
|
|
|
221
233
|
#### Attributes
|
|
222
234
|
|
|
223
|
-
| Attribute | Type | Required | Default | Notes
|
|
224
|
-
| ----------------- | --------- | ----------- | ---------------------- |
|
|
225
|
-
| `collection-id` | `string` | Yes | - | Collection ID
|
|
226
|
-
| `api-key` | `string` | Conditional | - | Required if you don’t set `.client`
|
|
227
|
-
| `client-id` | `string` | Conditional | - | Required if you don’t set `.client`
|
|
228
|
-
| `subscription-id` | `string` | No | - | Accepted attribute
|
|
229
|
-
| `base-url` | `string` | No | `https://api.jaaq.app` | API base URL
|
|
230
|
-
| `autoplay` | `boolean` | No | `false` | Any value except `"false"` enables
|
|
231
|
-
| `show-arrows` | `boolean` | No | `true` | Any value except `"false"` enables
|
|
232
|
-
| `show-dots` | `boolean` | No | `true` | Any value except `"false"` enables
|
|
235
|
+
| Attribute | Type | Required | Default | Notes |
|
|
236
|
+
| ----------------- | --------- | ----------- | ---------------------- | --------------------------------------------- |
|
|
237
|
+
| `collection-id` | `string` | Yes | - | Collection ID |
|
|
238
|
+
| `api-key` | `string` | Conditional | - | Required if you don’t set `.client` |
|
|
239
|
+
| `client-id` | `string` | Conditional | - | Required if you don’t set `.client` |
|
|
240
|
+
| `subscription-id` | `string` | No | - | Accepted attribute |
|
|
241
|
+
| `base-url` | `string` | No | `https://api.jaaq.app` | API base URL |
|
|
242
|
+
| `autoplay` | `boolean` | No | `false` | Any value except `"false"` enables |
|
|
243
|
+
| `show-arrows` | `boolean` | No | `true` | Any value except `"false"` enables |
|
|
244
|
+
| `show-dots` | `boolean` | No | `true` | Any value except `"false"` enables |
|
|
245
|
+
| `video-settings` | `string` | No | - | JSON stringified video player settings object |
|
|
233
246
|
|
|
234
247
|
#### Properties / methods
|
|
235
248
|
|
|
@@ -341,6 +354,14 @@ export function App() {
|
|
|
341
354
|
autoplay={false}
|
|
342
355
|
showArrows={true}
|
|
343
356
|
showDots={true}
|
|
357
|
+
videoSettings={{
|
|
358
|
+
controls: true,
|
|
359
|
+
showLogo: false,
|
|
360
|
+
showTitle: true,
|
|
361
|
+
showAuthor: true,
|
|
362
|
+
showDescription: false,
|
|
363
|
+
showCaptions: true,
|
|
364
|
+
}}
|
|
344
365
|
onLoaded={(collection) => console.log(collection)}
|
|
345
366
|
onSlideChange={(data) => console.log(data)}
|
|
346
367
|
onError={(err) => console.error(err)}
|
|
@@ -363,6 +384,7 @@ export function App() {
|
|
|
363
384
|
| `showArrows` | `boolean` | No | `true` |
|
|
364
385
|
| `showDots` | `boolean` | No | `true` |
|
|
365
386
|
| `className` | `string` | No | `''` |
|
|
387
|
+
| `videoSettings` | `VideoSettings` | No | - |
|
|
366
388
|
| `onLoaded` | `(collection: CollectionDTO) => void` | No | - |
|
|
367
389
|
| `onSlideChange` | `(data: { index: number; video: CollectionDTO['videos'][0] }) => void` | No | - |
|
|
368
390
|
| `onError` | `(error: Error) => void` | No | - |
|
|
@@ -459,6 +481,14 @@ const player = new JaaqCollectionPlayer('#container', {
|
|
|
459
481
|
autoplay: false,
|
|
460
482
|
showArrows: true,
|
|
461
483
|
showDots: true,
|
|
484
|
+
videoSettings: {
|
|
485
|
+
controls: true,
|
|
486
|
+
showLogo: false,
|
|
487
|
+
showTitle: true,
|
|
488
|
+
showAuthor: true,
|
|
489
|
+
showDescription: false,
|
|
490
|
+
showCaptions: true,
|
|
491
|
+
},
|
|
462
492
|
});
|
|
463
493
|
|
|
464
494
|
player.on('loaded', (collection) => console.log(collection));
|
|
@@ -468,17 +498,18 @@ player.on('error', (err) => console.error(err));
|
|
|
468
498
|
|
|
469
499
|
#### Config
|
|
470
500
|
|
|
471
|
-
| Option
|
|
472
|
-
|
|
|
473
|
-
| `collectionId`
|
|
474
|
-
| `apiKey`
|
|
475
|
-
| `clientId`
|
|
476
|
-
| `client`
|
|
477
|
-
| `baseUrl`
|
|
478
|
-
| `autoplay`
|
|
479
|
-
| `showArrows`
|
|
480
|
-
| `showDots`
|
|
481
|
-
| `className`
|
|
501
|
+
| Option | Type | Required | Default |
|
|
502
|
+
| --------------- | --------------- | ----------- | ------- |
|
|
503
|
+
| `collectionId` | `string` | Yes | - |
|
|
504
|
+
| `apiKey` | `string` | Conditional | - |
|
|
505
|
+
| `clientId` | `string` | Conditional | - |
|
|
506
|
+
| `client` | `JaaqClient` | Conditional | - |
|
|
507
|
+
| `baseUrl` | `string` | No | - |
|
|
508
|
+
| `autoplay` | `boolean` | No | `false` |
|
|
509
|
+
| `showArrows` | `boolean` | No | `true` |
|
|
510
|
+
| `showDots` | `boolean` | No | `true` |
|
|
511
|
+
| `className` | `string` | No | `''` |
|
|
512
|
+
| `videoSettings` | `VideoSettings` | No | - |
|
|
482
513
|
|
|
483
514
|
#### Events
|
|
484
515
|
|
|
@@ -546,11 +577,11 @@ Optional:
|
|
|
546
577
|
|
|
547
578
|
## CDN Usage
|
|
548
579
|
|
|
549
|
-
CI publishes files under the `
|
|
580
|
+
CI publishes files under the `latest/` prefix. Embed HTML files are available under `latest/embed/`.
|
|
550
581
|
|
|
551
582
|
Base URL:
|
|
552
583
|
|
|
553
|
-
- `https://cdn.jaaq.app/
|
|
584
|
+
- `https://cdn.jaaq.app/latest/`
|
|
554
585
|
|
|
555
586
|
### Available files (published by CI)
|
|
556
587
|
|
|
@@ -567,7 +598,7 @@ Base URL:
|
|
|
567
598
|
### Core SDK (UMD)
|
|
568
599
|
|
|
569
600
|
```html
|
|
570
|
-
<script src="https://cdn.jaaq.app/
|
|
601
|
+
<script src="https://cdn.jaaq.app/latest/jaaq-sdk.min.js"></script>
|
|
571
602
|
<script>
|
|
572
603
|
const client = JaaqSDK.createJaaqClient({
|
|
573
604
|
apiKey: 'YOUR_API_KEY',
|
|
@@ -583,7 +614,7 @@ Base URL:
|
|
|
583
614
|
Bundled (no external HLS dependency):
|
|
584
615
|
|
|
585
616
|
```html
|
|
586
|
-
<script src="https://cdn.jaaq.app/
|
|
617
|
+
<script src="https://cdn.jaaq.app/latest/jaaq-ui-bundled.min.js"></script>
|
|
587
618
|
<script>
|
|
588
619
|
const player = new JaaqUI.JaaqVideoPlayer(document.getElementById('player'), {
|
|
589
620
|
apiKey: 'YOUR_API_KEY',
|
|
@@ -597,7 +628,7 @@ Non-bundled (load hls.js separately):
|
|
|
597
628
|
|
|
598
629
|
```html
|
|
599
630
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
|
600
|
-
<script src="https://cdn.jaaq.app/
|
|
631
|
+
<script src="https://cdn.jaaq.app/latest/jaaq-ui.min.js"></script>
|
|
601
632
|
```
|
|
602
633
|
|
|
603
634
|
### Web components (UMD)
|
|
@@ -605,7 +636,7 @@ Non-bundled (load hls.js separately):
|
|
|
605
636
|
Bundled (no external HLS dependency):
|
|
606
637
|
|
|
607
638
|
```html
|
|
608
|
-
<script src="https://cdn.jaaq.app/
|
|
639
|
+
<script src="https://cdn.jaaq.app/latest/jaaq-webcomponents-bundled.min.js"></script>
|
|
609
640
|
<jaaq-video-player video-id="YOUR_VIDEO_ID" api-key="YOUR_API_KEY" client-id="YOUR_CLIENT_ID"></jaaq-video-player>
|
|
610
641
|
```
|
|
611
642
|
|
|
@@ -613,12 +644,12 @@ Non-bundled (load hls.js separately):
|
|
|
613
644
|
|
|
614
645
|
```html
|
|
615
646
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
|
616
|
-
<script src="https://cdn.jaaq.app/
|
|
647
|
+
<script src="https://cdn.jaaq.app/latest/jaaq-webcomponents.min.js"></script>
|
|
617
648
|
```
|
|
618
649
|
|
|
619
650
|
### React from CDN
|
|
620
651
|
|
|
621
|
-
The CI pipeline does not publish the React UMD bundle to `https://cdn.jaaq.app/
|
|
652
|
+
The CI pipeline does not publish the React UMD bundle to `https://cdn.jaaq.app/latest/`.
|
|
622
653
|
|
|
623
654
|
Use npm:
|
|
624
655
|
|
|
@@ -636,7 +667,7 @@ import { VideoPlayer } from '@jaaq/jaaq-sdk-js/ui/react';
|
|
|
636
667
|
|
|
637
668
|
```html
|
|
638
669
|
<iframe
|
|
639
|
-
src="https://cdn.jaaq.app/
|
|
670
|
+
src="https://cdn.jaaq.app/latest/embed/embed.html?apiKey=YOUR_API_KEY&clientId=YOUR_CLIENT_ID&videoId=YOUR_VIDEO_ID&autoplay=false"
|
|
640
671
|
width="800"
|
|
641
672
|
height="450"
|
|
642
673
|
frameborder="0"
|
|
@@ -713,7 +744,7 @@ Embed a collection of videos in a carousel format:
|
|
|
713
744
|
|
|
714
745
|
```html
|
|
715
746
|
<iframe
|
|
716
|
-
src="https://cdn.jaaq.app/
|
|
747
|
+
src="https://cdn.jaaq.app/latest/embed/embed-collection.html?apiKey=YOUR_API_KEY&clientId=YOUR_CLIENT_ID&collectionId=YOUR_COLLECTION_ID&autoplay=false&controls=true&showLogo=false&showTitle=true&showAuthor=true&showDescription=false&showCaptions=true"
|
|
717
748
|
width="100%"
|
|
718
749
|
height="600"
|
|
719
750
|
frameborder="0"
|
|
@@ -723,13 +754,21 @@ Embed a collection of videos in a carousel format:
|
|
|
723
754
|
|
|
724
755
|
### URL parameters
|
|
725
756
|
|
|
726
|
-
| Parameter
|
|
727
|
-
|
|
|
728
|
-
| `apiKey`
|
|
729
|
-
| `clientId`
|
|
730
|
-
| `collectionId`
|
|
731
|
-
| `autoplay`
|
|
732
|
-
| `baseUrl`
|
|
757
|
+
| Parameter | Required | Notes |
|
|
758
|
+
| ----------------- | -------- | ------------------------- |
|
|
759
|
+
| `apiKey` | Yes | API key |
|
|
760
|
+
| `clientId` | Yes | Client ID |
|
|
761
|
+
| `collectionId` | Yes | Collection ID |
|
|
762
|
+
| `autoplay` | No | `true`, `false`, `1`, `0` |
|
|
763
|
+
| `baseUrl` | No | API base URL |
|
|
764
|
+
| `controls` | No | `true`, `false`, `1`, `0` |
|
|
765
|
+
| `showLogo` | No | `true`, `false`, `1`, `0` |
|
|
766
|
+
| `showTitle` | No | `true`, `false`, `1`, `0` |
|
|
767
|
+
| `showAuthor` | No | `true`, `false`, `1`, `0` |
|
|
768
|
+
| `showDescription` | No | `true`, `false`, `1`, `0` |
|
|
769
|
+
| `showCaptions` | No | `true`, `false`, `1`, `0` |
|
|
770
|
+
| `width` | No | CSS width string |
|
|
771
|
+
| `height` | No | CSS height string |
|
|
733
772
|
|
|
734
773
|
### postMessage protocol
|
|
735
774
|
|
|
@@ -118,6 +118,33 @@
|
|
|
118
118
|
config.baseUrl = baseUrl;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
const showArrows = params.get('showArrows');
|
|
122
|
+
if (showArrows !== null) {
|
|
123
|
+
config.showArrows = showArrows === 'true' || showArrows === '1';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const showDots = params.get('showDots');
|
|
127
|
+
if (showDots !== null) {
|
|
128
|
+
config.showDots = showDots === 'true' || showDots === '1';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
config.videoSettings = {};
|
|
132
|
+
const videoOptionKeys = ['controls', 'showLogo', 'showTitle', 'showAuthor', 'showDescription', 'showCaptions', 'width', 'height'];
|
|
133
|
+
videoOptionKeys.forEach((key) => {
|
|
134
|
+
const value = params.get(key);
|
|
135
|
+
if (value !== null) {
|
|
136
|
+
if (key === 'width' || key === 'height') {
|
|
137
|
+
config.videoSettings[key] = value;
|
|
138
|
+
} else {
|
|
139
|
+
config.videoSettings[key] = value === 'true' || value === '1';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (Object.keys(config.videoSettings).length === 0) {
|
|
145
|
+
delete config.videoSettings;
|
|
146
|
+
}
|
|
147
|
+
|
|
121
148
|
return config;
|
|
122
149
|
}
|
|
123
150
|
|
|
@@ -155,6 +182,18 @@
|
|
|
155
182
|
player.setAttribute('autoplay', 'true');
|
|
156
183
|
}
|
|
157
184
|
|
|
185
|
+
if (config.showArrows !== undefined) {
|
|
186
|
+
player.setAttribute('show-arrows', config.showArrows ? 'true' : 'false');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (config.showDots !== undefined) {
|
|
190
|
+
player.setAttribute('show-dots', config.showDots ? 'true' : 'false');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (config.videoSettings && Object.keys(config.videoSettings).length > 0) {
|
|
194
|
+
player.setAttribute('video-settings', JSON.stringify(config.videoSettings));
|
|
195
|
+
}
|
|
196
|
+
|
|
158
197
|
player.style.width = '100%';
|
|
159
198
|
player.style.height = '100%';
|
|
160
199
|
player.style.display = 'block';
|
|
@@ -267,7 +306,7 @@
|
|
|
267
306
|
</script>
|
|
268
307
|
|
|
269
308
|
<script
|
|
270
|
-
src="https://cdn.jaaq.app/
|
|
309
|
+
src="https://cdn-dev.jaaq.app/latest/jaaq-webcomponents-bundled.min.js"
|
|
271
310
|
onerror="console.error('[Embed Collection] Failed to load web component script'); showError('Failed to load collection player script');"
|
|
272
311
|
onload="console.log('[Embed Collection] Web component script loaded');"
|
|
273
312
|
></script>
|
package/dist/embed/embed.html
CHANGED
|
@@ -118,6 +118,36 @@
|
|
|
118
118
|
config.baseUrl = baseUrl;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
const controls = params.get('controls');
|
|
122
|
+
if (controls !== null) {
|
|
123
|
+
config.controls = controls === 'true' || controls === '1';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const showLogo = params.get('showLogo');
|
|
127
|
+
if (showLogo !== null) {
|
|
128
|
+
config.showLogo = showLogo === 'true' || showLogo === '1';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const showTitle = params.get('showTitle');
|
|
132
|
+
if (showTitle !== null) {
|
|
133
|
+
config.showTitle = showTitle === 'true' || showTitle === '1';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const showAuthor = params.get('showAuthor');
|
|
137
|
+
if (showAuthor !== null) {
|
|
138
|
+
config.showAuthor = showAuthor === 'true' || showAuthor === '1';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const showDescription = params.get('showDescription');
|
|
142
|
+
if (showDescription !== null) {
|
|
143
|
+
config.showDescription = showDescription === 'true' || showDescription === '1';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const showCaptions = params.get('showCaptions');
|
|
147
|
+
if (showCaptions !== null) {
|
|
148
|
+
config.showCaptions = showCaptions === 'true' || showCaptions === '1';
|
|
149
|
+
}
|
|
150
|
+
|
|
121
151
|
return config;
|
|
122
152
|
}
|
|
123
153
|
|
|
@@ -158,6 +188,30 @@
|
|
|
158
188
|
player.setAttribute('width', config.width || '100%');
|
|
159
189
|
player.setAttribute('height', config.height || '100%');
|
|
160
190
|
|
|
191
|
+
if (config.controls !== undefined) {
|
|
192
|
+
player.setAttribute('controls', config.controls ? 'true' : 'false');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (config.showLogo !== undefined) {
|
|
196
|
+
player.setAttribute('show-logo', config.showLogo ? 'true' : 'false');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (config.showTitle !== undefined) {
|
|
200
|
+
player.setAttribute('show-title', config.showTitle ? 'true' : 'false');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (config.showAuthor !== undefined) {
|
|
204
|
+
player.setAttribute('show-author', config.showAuthor ? 'true' : 'false');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (config.showDescription !== undefined) {
|
|
208
|
+
player.setAttribute('show-description', config.showDescription ? 'true' : 'false');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (config.showCaptions !== undefined) {
|
|
212
|
+
player.setAttribute('show-captions', config.showCaptions ? 'true' : 'false');
|
|
213
|
+
}
|
|
214
|
+
|
|
161
215
|
player.addEventListener('jaaq:loaded', (e) => {
|
|
162
216
|
const video = e.detail;
|
|
163
217
|
notifyParent('loaded', { id: video.id, title: video.title, question: video.question });
|
|
@@ -262,7 +316,7 @@
|
|
|
262
316
|
</script>
|
|
263
317
|
|
|
264
318
|
<script
|
|
265
|
-
src="https://cdn.jaaq.app/
|
|
319
|
+
src="https://cdn-dev.jaaq.app/latest/jaaq-webcomponents-bundled.min.js"
|
|
266
320
|
onerror="console.error('[Embed] Failed to load web component script'); showError('Failed to load player script');"
|
|
267
321
|
onload="console.log('[Embed] Web component script loaded');"
|
|
268
322
|
></script>
|
package/dist/ui/index.cjs
CHANGED
|
@@ -4055,6 +4055,33 @@ class JaaqCollectionPlayer {
|
|
|
4055
4055
|
player.setAttribute('base-url', this.config.baseUrl);
|
|
4056
4056
|
player.setAttribute('autoplay', 'false');
|
|
4057
4057
|
player.setAttribute('width', '100%');
|
|
4058
|
+
if (this.config.videoSettings) {
|
|
4059
|
+
const settings = this.config.videoSettings;
|
|
4060
|
+
if (settings.controls !== undefined) {
|
|
4061
|
+
player.setAttribute('controls', String(settings.controls));
|
|
4062
|
+
}
|
|
4063
|
+
if (settings.showLogo !== undefined) {
|
|
4064
|
+
player.setAttribute('show-logo', String(settings.showLogo));
|
|
4065
|
+
}
|
|
4066
|
+
if (settings.showTitle !== undefined) {
|
|
4067
|
+
player.setAttribute('show-title', String(settings.showTitle));
|
|
4068
|
+
}
|
|
4069
|
+
if (settings.showAuthor !== undefined) {
|
|
4070
|
+
player.setAttribute('show-author', String(settings.showAuthor));
|
|
4071
|
+
}
|
|
4072
|
+
if (settings.showDescription !== undefined) {
|
|
4073
|
+
player.setAttribute('show-description', String(settings.showDescription));
|
|
4074
|
+
}
|
|
4075
|
+
if (settings.showCaptions !== undefined) {
|
|
4076
|
+
player.setAttribute('show-captions', String(settings.showCaptions));
|
|
4077
|
+
}
|
|
4078
|
+
if (settings.width !== undefined) {
|
|
4079
|
+
player.setAttribute('width', String(settings.width));
|
|
4080
|
+
}
|
|
4081
|
+
if (settings.height !== undefined) {
|
|
4082
|
+
player.setAttribute('height', String(settings.height));
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4058
4085
|
if (this.client && player.client !== undefined) {
|
|
4059
4086
|
player.client = this.client;
|
|
4060
4087
|
}
|
|
@@ -4369,7 +4396,17 @@ const COMPONENT_STYLES$1 = `
|
|
|
4369
4396
|
`;
|
|
4370
4397
|
class JaaqCollectionPlayerElement extends HTMLElement {
|
|
4371
4398
|
static get observedAttributes() {
|
|
4372
|
-
return [
|
|
4399
|
+
return [
|
|
4400
|
+
'collection-id',
|
|
4401
|
+
'api-key',
|
|
4402
|
+
'client-id',
|
|
4403
|
+
'subscription-id',
|
|
4404
|
+
'base-url',
|
|
4405
|
+
'autoplay',
|
|
4406
|
+
'show-arrows',
|
|
4407
|
+
'show-dots',
|
|
4408
|
+
'video-settings',
|
|
4409
|
+
];
|
|
4373
4410
|
}
|
|
4374
4411
|
constructor() {
|
|
4375
4412
|
super();
|
|
@@ -4394,7 +4431,7 @@ class JaaqCollectionPlayerElement extends HTMLElement {
|
|
|
4394
4431
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
4395
4432
|
if (!this.connected || oldValue === newValue)
|
|
4396
4433
|
return;
|
|
4397
|
-
if (name === 'collection-id') {
|
|
4434
|
+
if (name === 'collection-id' || name === 'video-settings') {
|
|
4398
4435
|
this.destroyCarousel();
|
|
4399
4436
|
this.initCarousel();
|
|
4400
4437
|
}
|
|
@@ -4486,6 +4523,16 @@ class JaaqCollectionPlayerElement extends HTMLElement {
|
|
|
4486
4523
|
const apiKey = this.getAttribute('api-key');
|
|
4487
4524
|
const clientId = this.getAttribute('client-id');
|
|
4488
4525
|
const baseUrl = this.getAttribute('base-url');
|
|
4526
|
+
const videoSettingsAttr = this.getAttribute('video-settings');
|
|
4527
|
+
let videoSettings = null;
|
|
4528
|
+
if (videoSettingsAttr) {
|
|
4529
|
+
try {
|
|
4530
|
+
videoSettings = JSON.parse(videoSettingsAttr);
|
|
4531
|
+
}
|
|
4532
|
+
catch (e) {
|
|
4533
|
+
console.warn('[CollectionPlayer] Failed to parse video-settings attribute', e);
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4489
4536
|
this.collectionData.videos.forEach((video) => {
|
|
4490
4537
|
const slide = document.createElement('li');
|
|
4491
4538
|
slide.className = 'splide__slide';
|
|
@@ -4499,6 +4546,32 @@ class JaaqCollectionPlayerElement extends HTMLElement {
|
|
|
4499
4546
|
player.setAttribute('base-url', baseUrl);
|
|
4500
4547
|
player.setAttribute('autoplay', 'false');
|
|
4501
4548
|
player.setAttribute('width', '100%');
|
|
4549
|
+
if (videoSettings) {
|
|
4550
|
+
if (videoSettings.controls !== undefined) {
|
|
4551
|
+
player.setAttribute('controls', String(videoSettings.controls));
|
|
4552
|
+
}
|
|
4553
|
+
if (videoSettings.showLogo !== undefined) {
|
|
4554
|
+
player.setAttribute('show-logo', String(videoSettings.showLogo));
|
|
4555
|
+
}
|
|
4556
|
+
if (videoSettings.showTitle !== undefined) {
|
|
4557
|
+
player.setAttribute('show-title', String(videoSettings.showTitle));
|
|
4558
|
+
}
|
|
4559
|
+
if (videoSettings.showAuthor !== undefined) {
|
|
4560
|
+
player.setAttribute('show-author', String(videoSettings.showAuthor));
|
|
4561
|
+
}
|
|
4562
|
+
if (videoSettings.showDescription !== undefined) {
|
|
4563
|
+
player.setAttribute('show-description', String(videoSettings.showDescription));
|
|
4564
|
+
}
|
|
4565
|
+
if (videoSettings.showCaptions !== undefined) {
|
|
4566
|
+
player.setAttribute('show-captions', String(videoSettings.showCaptions));
|
|
4567
|
+
}
|
|
4568
|
+
if (videoSettings.width !== undefined) {
|
|
4569
|
+
player.setAttribute('width', String(videoSettings.width));
|
|
4570
|
+
}
|
|
4571
|
+
if (videoSettings.height !== undefined) {
|
|
4572
|
+
player.setAttribute('height', String(videoSettings.height));
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4502
4575
|
slide.appendChild(player);
|
|
4503
4576
|
list.appendChild(slide);
|
|
4504
4577
|
});
|