@eluvio/elv-player-js 1.0.63 → 1.0.67

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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "1.0.63",
3
+ "version": "1.0.67",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "1.0.63",
3
+ "version": "1.0.67",
4
4
  "description": "![Eluvio Logo](src/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -114,6 +114,15 @@ class PlayerControls {
114
114
  this.playerOptions = playerOptions;
115
115
  this.posterUrl = posterUrl;
116
116
 
117
+ if(posterUrl) {
118
+ // Preload poster before setting it
119
+ const imagePreload = new Image();
120
+ imagePreload.src = posterUrl;
121
+ imagePreload.onload = () => {
122
+ this.video.poster = posterUrl;
123
+ };
124
+ }
125
+
117
126
  this.settingsMenuContent = "none";
118
127
  this.timeouts = {};
119
128
  this.played = false;
@@ -165,6 +174,41 @@ class PlayerControls {
165
174
  watermark.src = Logo;
166
175
  }
167
176
 
177
+ // Poster
178
+ /*
179
+ if(this.posterUrl) {
180
+ this.poster = CreateElement({
181
+ parent: this.target,
182
+ type: "img",
183
+ classes: ["eluvio-player__poster-image"],
184
+ label: "Poster Image",
185
+ options: {
186
+ src: this.posterUrl
187
+ }
188
+ });
189
+
190
+ this.video.addEventListener("play", () => {
191
+ if(this.poster) {
192
+ if(this.poster.parentNode) {
193
+ this.poster.parentNode.removeChild(this.poster);
194
+ }
195
+
196
+ this.poster = undefined;
197
+ }
198
+ });
199
+
200
+ this.poster.addEventListener("click", () => this.video.play());
201
+ this.poster.addEventListener("error", () => {
202
+ if(this.poster.parentNode) {
203
+ this.poster.parentNode.removeChild(this.poster);
204
+ }
205
+
206
+ this.poster = undefined;
207
+ });
208
+ }
209
+
210
+ */
211
+
168
212
  if(
169
213
  this.playerOptions.controls === EluvioPlayerParameters.controls.DEFAULT ||
170
214
  this.playerOptions.controls === EluvioPlayerParameters.controls.OFF
@@ -206,28 +250,6 @@ class PlayerControls {
206
250
  return;
207
251
  }
208
252
 
209
- // Poster
210
- if(this.posterUrl) {
211
- this.poster = CreateElement({
212
- parent: this.target,
213
- type: "img",
214
- classes: ["eluvio-player__poster-image"],
215
- label: "Poster Image",
216
- options: {
217
- src: this.posterUrl
218
- }
219
- });
220
-
221
- this.poster.addEventListener("click", () => this.video.play());
222
- this.poster.addEventListener("error", () => {
223
- if(this.poster.parentNode) {
224
- this.poster.parentNode.removeChild(this.poster);
225
- }
226
-
227
- this.poster = undefined;
228
- });
229
- }
230
-
231
253
  // Controls container
232
254
  const controls = CreateElement({
233
255
  parent: this.target,
@@ -463,14 +485,6 @@ class PlayerControls {
463
485
  this.video.addEventListener("play", () => {
464
486
  this.played = true;
465
487
 
466
- if(this.poster) {
467
- if(this.poster.parentNode) {
468
- this.poster.parentNode.removeChild(this.poster);
469
- }
470
-
471
- this.poster = undefined;
472
- }
473
-
474
488
  playPauseButton.innerHTML = PauseIcon;
475
489
  playPauseButton.classList.add("eluvio-player__controls__button-pause");
476
490
  playPauseButton.setAttribute("aria-label", "Pause");
package/src/index.js CHANGED
@@ -55,6 +55,10 @@ export const EluvioPlayerParameters = {
55
55
  settings: {
56
56
  OFF: false,
57
57
  ON: true
58
+ },
59
+ capLevelToPlayerSize: {
60
+ OFF: false,
61
+ ON: true
58
62
  }
59
63
  };
60
64
 
@@ -580,6 +584,7 @@ export class EluvioPlayer {
580
584
  maxBufferLength: 30,
581
585
  maxBufferSize: 300,
582
586
  enableWorker: true,
587
+ capLevelToPlayerSize: this.playerOptions.capLevelToPlayerSize,
583
588
  xhrSetup: xhr => {
584
589
  xhr.setRequestHeader("Authorization", `Bearer ${authorizationToken}`);
585
590
 
@@ -639,7 +644,12 @@ export class EluvioPlayer {
639
644
  }
640
645
 
641
646
  if(error.fatal || this.errors === 3) {
642
- this.HardReload(error);
647
+ if(error.response.code === 403) {
648
+ // Not allowed to access
649
+ this.Destroy();
650
+ } else {
651
+ this.HardReload(error);
652
+ }
643
653
  }
644
654
  });
645
655
 
@@ -648,6 +658,16 @@ export class EluvioPlayer {
648
658
  const DashPlayer = (await import("dashjs")).default;
649
659
  dashPlayer = DashPlayer.MediaPlayer().create();
650
660
 
661
+ if(this.playerOptions.capLevelToPlayerSize) {
662
+ dashPlayer.updateSettings({
663
+ "streaming": {
664
+ "abr": {
665
+ "limitBitrateByPortal": true
666
+ }
667
+ }
668
+ });
669
+ }
670
+
651
671
  playoutUrl.removeQuery("authorization");
652
672
  dashPlayer.extend("RequestModifier", function () {
653
673
  return {
@@ -243,6 +243,7 @@ $button-height: 35px;
243
243
  }
244
244
 
245
245
  &__slider-container__input {
246
+ width: 100%;
246
247
  z-index: 0;
247
248
  }
248
249