@eluvio/elv-player-js 2.0.8 → 2.0.10

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.
@@ -1,4 +1,4 @@
1
- import { c as cI, e as CI, r as vA, a as eI, b as fA, i as dA, s as xA, g as wI } from "./index-CQ7iPH2P.mjs";
1
+ import { c as cI, e as CI, r as vA, a as eI, b as fA, i as dA, s as xA, g as wI } from "./index-DH690yy1.mjs";
2
2
  class EA {
3
3
  constructor(I) {
4
4
  this.wasm = I;
@@ -319,9 +319,11 @@ export class EluvioPlayer {
319
319
  });
320
320
 
321
321
  const CheckIsLive = () => {
322
- if(this.canPlay && !isFinite(this.video.duration)) {
322
+ if(!this.canPlay) { return; }
323
+
324
+ if(!isFinite(this.video.duration)) {
323
325
  this.isLive = true;
324
- } else if(this.video.duration && this.videoDuration > 0 && Math.abs(this.video.duration - this.videoDuration) > 1) {
326
+ } else if(this.video.duration && this.videoDuration > 0 && this.video.duration - this.videoDuration > 1) {
325
327
  this.isLive = true;
326
328
  }
327
329
  };
@@ -728,6 +730,13 @@ export class EluvioPlayer {
728
730
  ]
729
731
  .map(event => dashPlayer.on(event, () => this.__SettingsUpdate()));
730
732
 
733
+ // Subtitle track change
734
+ dashPlayer.on(this.Dash.MediaPlayer.events.METRIC_CHANGED, event => {
735
+ if(!event || event.mediaType !== "text") { return; }
736
+
737
+ this.__SettingsUpdate();
738
+ });
739
+
731
740
  this.player = dashPlayer;
732
741
  this.dashPlayer = dashPlayer;
733
742
  }
@@ -765,10 +774,13 @@ export class EluvioPlayer {
765
774
 
766
775
  const client = await this.__Client();
767
776
 
777
+ const authorizationToken = this.sourceOptions &&
778
+ this.sourceOptions.playoutParameters &&
779
+ this.sourceOptions.playoutParameters.authorizationToken;
768
780
  const audit =
769
781
  this.isLive ?
770
- await client.AuditStream({versionHash: this.contentHash}) :
771
- await client.AuditContentObject({versionHash: this.contentHash});
782
+ await client.AuditStream({versionHash: this.contentHash, authorizationToken}) :
783
+ await client.AuditContentObject({versionHash: this.contentHash, authorizationToken});
772
784
 
773
785
  if(!audit.verified) {
774
786
  return;
@@ -74,7 +74,7 @@
74
74
  .seek-container {
75
75
  --progress-height: 3px;
76
76
  --progress-height-expanded: 10px;
77
- --progress-height-expanded-mobile: 15px;
77
+ --progress-height-expanded-mobile: 8px;
78
78
  --color-seek-background: rgba(255, 255, 255, 10%);
79
79
  --color-seek-buffer: rgba(255, 255, 255, 10%);
80
80
  --color-seek-active: rgba(255, 255, 255, 50%);
@@ -407,7 +407,7 @@
407
407
 
408
408
  .verification-menu {
409
409
  color: var(--color-menu-text);
410
- padding: 10px 0 0;
410
+ padding: 10px 0 5px;
411
411
 
412
412
  &__group {
413
413
  display: flex;
@@ -416,8 +416,13 @@
416
416
  }
417
417
 
418
418
  &__group-icon {
419
- height: 30px;
420
- width: 30px;
419
+ height: 35px;
420
+ width: 35px;
421
+
422
+ &--cc {
423
+ height: 30px;
424
+ width: 30px;
425
+ }
421
426
 
422
427
  svg {
423
428
  height: 100%;
@@ -521,6 +526,11 @@
521
526
  .verification-menu__group-icon {
522
527
  height: 45px;
523
528
  width: 45px;
529
+
530
+ &--cc {
531
+ height: 38px;
532
+ width: 38px;
533
+ }
524
534
  }
525
535
 
526
536
  .verification-menu__group-title {
@@ -536,25 +546,87 @@
536
546
 
537
547
  /* Player size/orientation adjustments */
538
548
 
549
+ :global(.__eluvio-player--size-md),
550
+ :global(.__eluvio-player--size-sm) {
551
+ .menu-option {
552
+ font-size: 14px;
553
+ min-height: unset;
554
+ padding: 3px 10px;
555
+ }
556
+
557
+ .verification-menu {
558
+ &__group-icon {
559
+ height: 23px;
560
+ width: 23px;
561
+
562
+ &--cc {
563
+ height: 20px;
564
+ width: 20px;
565
+ }
566
+ }
567
+
568
+ &__group {
569
+ align-items: center;
570
+ }
571
+
572
+ &__details,
573
+ &__group {
574
+ padding-inline: 15px;
575
+ }
576
+
577
+ &__group-title {
578
+ font-size: 12px;
579
+ }
580
+
581
+ &__group-subtitle {
582
+ font-size: 10px;
583
+ }
584
+
585
+ &__detail {
586
+ align-items: flex-start;
587
+ flex-direction: column;
588
+ justify-content: center;
589
+ }
590
+
591
+ &__detail-label,
592
+ &__detail-value {
593
+ font-size: 10px;
594
+ }
595
+
596
+ &__detail-copy {
597
+ height: 15px;
598
+ }
599
+ }
600
+ }
601
+
539
602
  :global(.__eluvio-player--size-sm) {
540
603
  .volume-slider {
541
604
  display: none;
542
605
  }
543
606
 
544
607
  .menu {
545
- bottom: 75px;
546
- max-width: calc(var(--portal-width) - 30px);
547
- min-width: calc(var(--portal-width) - 30px);
608
+ bottom: 50px;
609
+ gap: 3px;
610
+ max-height: calc(var(--portal-height) - 80px);
611
+ max-width: min(600px, calc(var(--portal-width) - 30px));
612
+ min-height: unset;
613
+ min-width: min(600px, calc(var(--portal-width) - 30px));
548
614
  right: 10px;
549
615
  }
550
616
 
551
617
  .menu-option {
552
- font-size: 14px;
553
- min-height: 36px;
554
- padding: 5px 10px;
618
+ font-size: 12px;
619
+ min-height: 25px;
620
+ padding: 2px 10px;
621
+ }
622
+
623
+ .menu-option-icon {
624
+ height: 20px;
555
625
  }
556
626
 
557
627
  .seek-container {
628
+ height: calc(var(--progress-height-expanded) + 5px);
629
+
558
630
  &:hover,
559
631
  &:active,
560
632
  &:focus,
@@ -580,36 +652,6 @@
580
652
  }
581
653
  }
582
654
  }
583
-
584
- .verification-menu {
585
- &__details,
586
- &__group {
587
- padding-inline: 15px;
588
- }
589
-
590
- &__group-title {
591
- font-size: 14px;
592
- }
593
-
594
- &__group-subtitle {
595
- font-size: 12px;
596
- }
597
-
598
- &__detail {
599
- align-items: flex-start;
600
- flex-direction: column;
601
- justify-content: center;
602
- }
603
-
604
- &__detail-label,
605
- &__detail-value {
606
- font-size: 12px;
607
- }
608
-
609
- &__detail-copy {
610
- height: 15px;
611
- }
612
- }
613
655
  }
614
656
 
615
657
  .copy-button {
@@ -65,10 +65,10 @@
65
65
  align-items: center;
66
66
  color: var(--color-button);
67
67
  display: flex;
68
- height: 100%;
69
- padding: 5px;
68
+ height: 30px;
69
+ padding: 4px;
70
70
  transition: color 0.15s ease;
71
- width: auto;
71
+ width: 30px;
72
72
 
73
73
  svg {
74
74
  height: 100%;
@@ -167,6 +167,7 @@
167
167
 
168
168
  .center-play-button {
169
169
  height: 100px;
170
+ margin-bottom: 30px;
170
171
  transition: opacity 0.5s ease;
171
172
  width: 100px;
172
173
  z-index: var(--layer-center-button);
@@ -226,11 +227,6 @@
226
227
  .play-pause-button {
227
228
  padding: 0;
228
229
  }
229
-
230
- .right-control-button {
231
- height: 35px;
232
- margin-bottom: 1px;
233
- }
234
230
  }
235
231
 
236
232
  .time {
@@ -338,18 +334,12 @@
338
334
 
339
335
  .icon-button {
340
336
  border: 1px solid transparent;
341
- border-radius: 100%;
337
+ padding: 0;
342
338
  transition: background-color 0.25s ease, color 0.25s ease;
343
339
 
344
340
  &-active,
345
341
  &:focus-visible {
346
- background-color: rgba(255, 255, 255, 85%);
347
- color: #000;
348
- filter: drop-shadow(0 0 5px #FFF);
349
- }
350
-
351
- &:focus-visible {
352
- border: 1px solid var(--color-highlight);
342
+ filter: drop-shadow(0 0 3px rgba(255, 255, 255, 50%));
353
343
  }
354
344
  }
355
345
  }
@@ -393,14 +383,22 @@
393
383
  --content-image-size: 65px;
394
384
  }
395
385
 
386
+ .icon-button {
387
+ height: 25px;
388
+ min-width: 25px;
389
+ width: 25px;
390
+ }
391
+
396
392
  .controls {
397
393
  gap: 8px;
398
- height: 45px;
394
+ height: max-content;
395
+ padding: 0 5px 5px;
399
396
  }
400
397
 
401
398
  .center-play-button {
402
- height: 65px;
403
- width: 65px;
399
+ height: 50px;
400
+ margin-bottom: 15px;
401
+ width: 50px;
404
402
  }
405
403
 
406
404
  /* Position menus relative to whole player */
@@ -433,6 +431,7 @@
433
431
 
434
432
  .time {
435
433
  font-size: 10px;
434
+ min-width: max-content;
436
435
  }
437
436
 
438
437
  .collection-button-text {
@@ -89,4 +89,10 @@
89
89
  .error-message {
90
90
  font-size: 16px;
91
91
  }
92
+
93
+ .spinner {
94
+ border-width: 3px;
95
+ height: 30px;
96
+ width: 30px;
97
+ }
92
98
  }
@@ -380,7 +380,7 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
380
380
  content = (
381
381
  <>
382
382
  <div className={CommonStyles["verification-menu__group"]}>
383
- <div dangerouslySetInnerHTML={{__html: Icons.ContentBadgeIcon}} style={{width: 35, height: 35}} className={CommonStyles["verification-menu__group-icon"]} />
383
+ <div dangerouslySetInnerHTML={{__html: Icons.ContentBadgeIcon}} className={CommonStyles["verification-menu__group-icon"]} />
384
384
  <div className={CommonStyles["verification-menu__group-text"]}>
385
385
  <div className={CommonStyles["verification-menu__group-title"]}>
386
386
  This content has been verified as authentic
@@ -391,7 +391,7 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
391
391
  </div>
392
392
  </div>
393
393
  <div className={CommonStyles["verification-menu__group"]}>
394
- <div dangerouslySetInnerHTML={{__html: Icons.ContentCredentialsIcon}} style={{height: 30, maxWidth: 30}} className={CommonStyles["verification-menu__group-icon"]} />
394
+ <div dangerouslySetInnerHTML={{__html: Icons.ContentCredentialsIcon}} className={[CommonStyles["verification-menu__group-icon"], CommonStyles["verification-menu__group-icon--cc"]].join(" ")} />
395
395
  <div className={CommonStyles["verification-menu__group-text"]}>
396
396
  <button onClick={() => setShowDetails(true)} className={CommonStyles["verification-menu__group-title"]}>
397
397
  View Content Credentials
@@ -405,7 +405,7 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
405
405
  content = (
406
406
  <>
407
407
  <div className={CommonStyles["verification-menu__group"]}>
408
- <div dangerouslySetInnerHTML={{__html: Icons.ContentBadgeIcon}} style={{width: 50, height: 50}} className={CommonStyles["verification-menu__group-icon"]} />
408
+ <div dangerouslySetInnerHTML={{__html: Icons.ContentBadgeIcon}} className={CommonStyles["verification-menu__group-icon"]} />
409
409
  <div className={CommonStyles["verification-menu__group-text"]}>
410
410
  <div className={CommonStyles["verification-menu__group-title"]}>
411
411
  This content has been verified as authentic
@@ -416,7 +416,7 @@ export const ContentVerificationMenu = ({player, Hide, className=""}) => {
416
416
  </div>
417
417
  </div>
418
418
  <div className={CommonStyles["verification-menu__group"]}>
419
- <div dangerouslySetInnerHTML={{__html: Icons.ContentCredentialsIcon}} className={CommonStyles["verification-menu__group-icon"]} />
419
+ <div dangerouslySetInnerHTML={{__html: Icons.ContentCredentialsIcon}} className={[CommonStyles["verification-menu__group-icon"], CommonStyles["verification-menu__group-icon--cc"]].join(" ")} />
420
420
  <div className={CommonStyles["verification-menu__group-text"]}>
421
421
  <button onClick={() => setShowDetails(true)} className={CommonStyles["verification-menu__group-title"]}>
422
422
  Content Credentials
@@ -126,19 +126,20 @@ export const ObserveVideoTime = ({video, rate=10, setCurrentTime}) => {
126
126
 
127
127
  export const ObserveResize = ({target, setSize, setOrientation, setDimensions}) => {
128
128
  let dimensionsUpdateTimeout;
129
- const observer = new ResizeObserver(entries => {
129
+
130
+ const ResizeUpdate = () => {
130
131
  clearTimeout(dimensionsUpdateTimeout);
131
132
 
132
- const dimensions = entries[0].contentRect;
133
+ const dimensions = target.getBoundingClientRect();
133
134
 
134
135
  let size = "sm";
135
136
  let orientation = "landscape";
136
137
  // Use actual player size instead of media queries
137
- if(dimensions.width > 1400) {
138
+ if(dimensions.width > 1400 && dimensions.height > 600) {
138
139
  size = "xl";
139
- } else if(dimensions.width > 1000) {
140
+ } else if(dimensions.width > 1000 && dimensions.height > 400) {
140
141
  size = "lg";
141
- } else if(dimensions.width > 650) {
142
+ } else if(dimensions.width > 650 && dimensions.height > 300) {
142
143
  size = "md";
143
144
  }
144
145
 
@@ -152,8 +153,11 @@ export const ObserveResize = ({target, setSize, setOrientation, setDimensions})
152
153
  dimensionsUpdateTimeout = setTimeout(() => {
153
154
  setDimensions({width: dimensions.width, height: dimensions.height});
154
155
  }, 500);
155
- });
156
+ };
157
+
158
+ ResizeUpdate();
156
159
 
160
+ const observer = new ResizeObserver(ResizeUpdate);
157
161
  observer.observe(target);
158
162
 
159
163
  return () => observer.disconnect();
@@ -162,7 +162,9 @@ const ContentVerificationControls = ({player}) => {
162
162
 
163
163
  UpdateVerification();
164
164
 
165
- player.controls.RegisterSettingsListener(UpdateVerification);
165
+ const disposeSettingsListener = player.controls.RegisterSettingsListener(UpdateVerification);
166
+
167
+ return () => disposeSettingsListener && disposeSettingsListener();
166
168
  }, []);
167
169
 
168
170
  if(!contentVerified) {
@@ -188,13 +190,20 @@ const ContentVerificationControls = ({player}) => {
188
190
  const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setRecentUserAction, className=""}) => {
189
191
  const [videoState, setVideoState] = useState(undefined);
190
192
  const [playerClickHandler, setPlayerClickHandler] = useState(undefined);
193
+ const [menuVisible, setMenuVisible] = useState(player.controls.IsMenuVisible());
191
194
 
192
195
  useEffect(() => {
193
196
  setPlayerClickHandler(PlayerClick({player, setRecentUserAction}));
194
197
 
198
+ const UpdateMenuVisibility = () => setMenuVisible(player.controls.IsMenuVisible());
199
+ const disposeSettingsListener = player.controls.RegisterSettingsListener(UpdateMenuVisibility);
200
+
195
201
  const disposeVideoObserver = ObserveVideo({target: player.target, video: player.video, setVideoState});
196
202
 
197
- return () => disposeVideoObserver && disposeVideoObserver();
203
+ return () => {
204
+ disposeSettingsListener && disposeSettingsListener();
205
+ disposeVideoObserver && disposeVideoObserver();
206
+ }
198
207
  }, []);
199
208
 
200
209
  if(!videoState) { return null; }
@@ -202,7 +211,7 @@ const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setR
202
211
  const collectionInfo = player.controls.GetCollectionInfo();
203
212
 
204
213
  // Title autohide is not dependent on controls settings
205
- const showUI = recentlyInteracted || !playbackStarted || player.controls.IsMenuVisible();
214
+ const showUI = recentlyInteracted || !playbackStarted || menuVisible;
206
215
  const hideControls = !showUI && player.playerOptions.controls === EluvioPlayerParameters.controls.AUTO_HIDE;
207
216
 
208
217
  player.__SetControlsVisibility(!hideControls);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "![Eluvio Logo](lib/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "package-lock.json"
37
37
  ],
38
38
  "dependencies": {
39
- "@eluvio/elv-client-js": "^4.0.89",
39
+ "@eluvio/elv-client-js": "^4.0.92",
40
40
  "dashjs": "~4.7.0",
41
41
  "focus-visible": "^5.2.0",
42
42
  "hls.js": "~1.5.12",