@eluvio/elv-player-js 1.0.89 → 1.0.90

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.89",
3
+ "version": "1.0.90",
4
4
  "description": "![Eluvio Logo](src/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -112,6 +112,21 @@ class PlayerControls {
112
112
  this.target = target;
113
113
  this.video = video;
114
114
  this.playerOptions = playerOptions;
115
+ this.timeouts = {};
116
+ this.played = false;
117
+ this.controlsHover = false;
118
+ this.progressHidden = false;
119
+
120
+ if(posterUrl) {
121
+ this.SetPosterUrl(posterUrl);
122
+ }
123
+
124
+ this.InitializeControls(className);
125
+ }
126
+
127
+ SetPosterUrl(posterUrl) {
128
+ if(!posterUrl) { return; }
129
+
115
130
  this.posterUrl = posterUrl;
116
131
 
117
132
  if(posterUrl) {
@@ -122,13 +137,6 @@ class PlayerControls {
122
137
  this.video.poster = posterUrl;
123
138
  };
124
139
  }
125
-
126
- this.timeouts = {};
127
- this.played = false;
128
- this.controlsHover = false;
129
- this.progressHidden = false;
130
-
131
- this.InitializeControls(className);
132
140
  }
133
141
 
134
142
  FadeOut(key, elements, delay=250, callback) {
package/src/index.js CHANGED
@@ -541,50 +541,45 @@ export class EluvioPlayer {
541
541
  if(this.clientOptions.promptTicket && !this.clientOptions.ticketCode) {
542
542
  if(!this.clientOptions.tenantId) { throw Error("ELUVIO PLAYER: Tenant ID must be provided if ticket code is needed."); }
543
543
 
544
- controlsPromise.then(() =>
545
- this.controls.InitializeTicketPrompt(async (code) => {
546
- code = (code || "").trim();
547
- let subject = this.clientOptions.ticketSubject;
548
- if(code.includes(":")) {
549
- subject = code.split(":")[0];
550
- code = code.split(":")[1];
551
- }
544
+ this.controls.InitializeTicketPrompt(async (code) => {
545
+ code = (code || "").trim();
546
+ let subject = this.clientOptions.ticketSubject;
547
+ if(code.includes(":")) {
548
+ subject = code.split(":")[0];
549
+ code = code.split(":")[1];
550
+ }
552
551
 
553
- await this.clientOptions.client.RedeemCode({
554
- tenantId: this.clientOptions.tenantId,
555
- ntpId: this.clientOptions.ntpId,
556
- code,
557
- email: subject
558
- });
552
+ await this.clientOptions.client.RedeemCode({
553
+ tenantId: this.clientOptions.tenantId,
554
+ ntpId: this.clientOptions.ntpId,
555
+ code,
556
+ email: subject
557
+ });
559
558
 
560
- this.ticketInitialized = true;
561
- this.clientOptions.ticketCode = code;
562
- this.originalParameters.clientOptions.client = this.clientOptions.client;
563
- this.originalParameters.clientOptions.ticketCode = code;
559
+ this.ticketInitialized = true;
560
+ this.clientOptions.ticketCode = code;
561
+ this.originalParameters.clientOptions.client = this.clientOptions.client;
562
+ this.originalParameters.clientOptions.ticketCode = code;
564
563
 
565
- this.Initialize(this.target);
566
- })
567
- );
564
+ this.Initialize(this.target);
565
+ });
568
566
 
569
567
  return;
570
568
  }
571
569
 
572
570
  let { protocol, drm, playoutUrl, drms, multiviewOptions } = await playoutOptionsPromise;
573
571
 
574
- let controlsPromise;
575
572
  if(["fairplay", "sample-aes"].includes(drm)) {
576
573
  // Switch to default controls if using fairplay or sample aes
577
574
  if(this.playerOptions.controls !== EluvioPlayerParameters.controls.OFF) {
578
575
  this.playerOptions.controls = EluvioPlayerParameters.controls.DEFAULT;
579
576
  this.video.controls = true;
580
577
  }
581
- } else {
582
- controlsPromise = this.PosterUrl().then(posterUrl => {
583
- this.posterUrl = posterUrl;
584
- this.controls = new PlayerControls(this.target, this.video, this.playerOptions, posterUrl, this.playerOptions.controlsClassName);
585
- });
586
578
  }
587
579
 
580
+ this.controls = new PlayerControls(this.target, this.video, this.playerOptions, this.playerOptions.controlsClassName);
581
+ this.PosterUrl().then(posterUrl => this.controls.SetPosterUrl(posterUrl));
582
+
588
583
  multiviewOptions.target = this.target;
589
584
 
590
585
  playoutUrl = URI(playoutUrl);
@@ -593,9 +588,9 @@ export class EluvioPlayer {
593
588
  playoutUrl.query(true).authorization;
594
589
 
595
590
  if(protocol === "hls") {
596
- await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise});
591
+ await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
597
592
  } else {
598
- await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise});
593
+ await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
599
594
  }
600
595
 
601
596
  if(this.playerOptions.playerCallback) {
@@ -634,18 +629,22 @@ export class EluvioPlayer {
634
629
  }
635
630
  }
636
631
 
637
- async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions, controlsPromise}) {
632
+ async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions}) {
638
633
  const HLSPlayer = (await import("hls-fix")).default;
639
634
 
640
635
  if(drm === "fairplay") {
641
636
  InitializeFairPlayStream({playoutOptions: this.sourceOptions.playoutOptions, video: this.video});
642
637
 
643
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
638
+ if(multiviewOptions.enabled) {
639
+ this.controls.InitializeMultiViewControls(multiviewOptions);
640
+ }
644
641
  this.UpdateTextTracks();
645
642
  } else if(!HLSPlayer.isSupported() || drm === "sample-aes") {
646
643
  this.video.src = playoutUrl.toString();
647
644
 
648
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
645
+ if(multiviewOptions.enabled) {
646
+ this.controls.InitializeMultiViewControls(multiviewOptions);
647
+ }
649
648
  } else {
650
649
  playoutUrl.removeQuery("authorization");
651
650
 
@@ -677,7 +676,7 @@ export class EluvioPlayer {
677
676
  hlsPlayer.nextLevel = hlsPlayer.currentLevel;
678
677
  };
679
678
 
680
- controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions));
679
+ this.controls.InitializeMultiViewControls(multiviewOptions);
681
680
  }
682
681
 
683
682
  if(this.controls) {
@@ -785,7 +784,7 @@ export class EluvioPlayer {
785
784
  }
786
785
  }
787
786
 
788
- async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise}) {
787
+ async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions}) {
789
788
  const DashPlayer = (await import("dashjs")).default;
790
789
  const dashPlayer = DashPlayer.MediaPlayer().create();
791
790
 
@@ -829,7 +828,9 @@ export class EluvioPlayer {
829
828
  this.playerOptions.autoplay === EluvioPlayerParameters.autoplay.ON
830
829
  );
831
830
 
832
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
831
+ if(multiviewOptions.enabled) {
832
+ this.controls.InitializeMultiViewControls(multiviewOptions);
833
+ }
833
834
 
834
835
  const UpdateQualityOptions = () => {
835
836
  try {