@eluvio/elv-player-js 1.0.113 → 1.0.114

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.114",
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,41 @@ 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
+ if(error && [401, 403].includes(error.status) || [401, 403].includes(error.code)) {
645
+ try {
646
+ const client = await this.Client();
647
+
648
+ const targetHash =
649
+ this.sourceOptions.playoutParameters.linkPath ?
650
+ await client.LinkTarget({...this.sourceOptions.playoutParameters}) :
651
+ this.sourceOptions.playoutParameters.versionHash ||
652
+ await client.LatestVersionHash({objectId: this.sourceOptions.playoutParameters.objectId});
653
+
654
+ const permissionErrorMessage = await client.ContentObjectMetadata({
655
+ versionHash: targetHash,
656
+ metadataSubtree: "public/asset_metadata/permission_message",
657
+ authorizationToken: this.sourceOptions.playoutParameters.authorizationToken
658
+ });
659
+
660
+ if(permissionErrorMessage) {
661
+ const errorMessage = CreateElement({
662
+ parent: this.target,
663
+ classes: ["eluvio-player__error-message"]
664
+ });
665
+
666
+ CreateElement({
667
+ parent: errorMessage,
668
+ classes: ["eluvio-player__error-message__text"]
669
+ }).innerHTML = permissionErrorMessage;
670
+
671
+ this.target.classList.add("eluvio-player--error");
672
+ }
673
+ // eslint-disable-next-line no-empty
674
+ } catch(error) {}
675
+ }
676
+
677
+
643
678
  if(this.playerOptions.errorCallback) {
644
679
  this.playerOptions.errorCallback(error, this);
645
680
  }
@@ -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
  }