@eluvio/elv-player-js 1.0.113 → 1.0.115

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "description": "![Eluvio Logo](src/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -640,6 +640,42 @@ export class EluvioPlayer {
640
640
  this.Destroy();
641
641
  }
642
642
  } catch (error) {
643
+ // If playout failed due to a permission issue, check the content to see if there is a message to display
644
+ let permissionErrorMessage;
645
+ if(error && [401, 403].includes(error.status) || [401, 403].includes(error.code)) {
646
+ try {
647
+ const client = await this.Client();
648
+
649
+ const targetHash =
650
+ this.sourceOptions.playoutParameters.linkPath ?
651
+ await client.LinkTarget({...this.sourceOptions.playoutParameters}) :
652
+ this.sourceOptions.playoutParameters.versionHash ||
653
+ await client.LatestVersionHash({objectId: this.sourceOptions.playoutParameters.objectId});
654
+
655
+ permissionErrorMessage = await client.ContentObjectMetadata({
656
+ versionHash: targetHash,
657
+ metadataSubtree: "public/asset_metadata/permission_message",
658
+ authorizationToken: this.sourceOptions.playoutParameters.authorizationToken
659
+ });
660
+
661
+ if(permissionErrorMessage) {
662
+ const errorMessage = CreateElement({
663
+ parent: this.target,
664
+ classes: ["eluvio-player__error-message"]
665
+ });
666
+
667
+ CreateElement({
668
+ parent: errorMessage,
669
+ classes: ["eluvio-player__error-message__text"]
670
+ }).innerHTML = permissionErrorMessage;
671
+
672
+ this.target.classList.add("eluvio-player--error");
673
+ }
674
+ // eslint-disable-next-line no-empty
675
+ } catch(error) {}
676
+ }
677
+
678
+ error.permission_message = permissionErrorMessage;
643
679
  if(this.playerOptions.errorCallback) {
644
680
  this.playerOptions.errorCallback(error, this);
645
681
  }
@@ -41,6 +41,31 @@ $button-height: 35px;
41
41
  position: relative;
42
42
  width: 100%;
43
43
 
44
+ &--error {
45
+ .eluvio-player__controls,
46
+ .eluvio-player__big-play-button {
47
+ display: none;
48
+ }
49
+ }
50
+
51
+ &__error-message {
52
+ position: absolute;
53
+ display: flex;
54
+ height: 100%;
55
+ width: 100%;
56
+ z-index: 1000;
57
+ align-items: center;
58
+ justify-content: center;
59
+ padding: 20px;
60
+ }
61
+
62
+ &__error-message__text {
63
+ color: $error-color;
64
+ font-size: 24px;
65
+ text-align: center;
66
+ max-width: 600px;
67
+ }
68
+
44
69
  // Seek indicator
45
70
  &--seek-left,
46
71
  &--seek-right {
@@ -78,7 +103,6 @@ $button-height: 35px;
78
103
  * {
79
104
  box-sizing: border-box;
80
105
  font-family: "Helvetica Neue", Helvetica, sans-serif;
81
- line-height: 1;
82
106
  overscroll-behavior-y: contain; // sass-lint:disable-line no-misspelled-properties
83
107
  }
84
108
 
@@ -650,6 +674,11 @@ $button-height: 35px;
650
674
 
651
675
  &.eluvio-player-m,
652
676
  &.eluvio-player-s {
677
+ .eluvio-player__error-message__text {
678
+ font-size: 18px;
679
+ }
680
+
681
+
653
682
  .eluvio-player__watermark {
654
683
  height: 10px;
655
684
  top: 10px;
@@ -703,6 +732,10 @@ $button-height: 35px;
703
732
  }
704
733
 
705
734
  &.eluvio-player-s {
735
+ .eluvio-player__error-message__text {
736
+ font-size: 14px;
737
+ }
738
+
706
739
  .eluvio-player__controls__time {
707
740
  display: none;
708
741
  }