@eluvio/elv-player-js 1.0.88 → 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.88",
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
@@ -538,44 +538,48 @@ export class EluvioPlayer {
538
538
  });
539
539
  this.resizeObserver.observe(this.target);
540
540
 
541
- const controlsPromise = this.PosterUrl().then(posterUrl => {
542
- this.posterUrl = posterUrl;
543
- this.controls = new PlayerControls(this.target, this.video, this.playerOptions, posterUrl, this.playerOptions.controlsClassName);
544
- });
545
-
546
541
  if(this.clientOptions.promptTicket && !this.clientOptions.ticketCode) {
547
542
  if(!this.clientOptions.tenantId) { throw Error("ELUVIO PLAYER: Tenant ID must be provided if ticket code is needed."); }
548
543
 
549
- controlsPromise.then(() =>
550
- this.controls.InitializeTicketPrompt(async (code) => {
551
- code = (code || "").trim();
552
- let subject = this.clientOptions.ticketSubject;
553
- if(code.includes(":")) {
554
- subject = code.split(":")[0];
555
- code = code.split(":")[1];
556
- }
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
+ }
557
551
 
558
- await this.clientOptions.client.RedeemCode({
559
- tenantId: this.clientOptions.tenantId,
560
- ntpId: this.clientOptions.ntpId,
561
- code,
562
- email: subject
563
- });
552
+ await this.clientOptions.client.RedeemCode({
553
+ tenantId: this.clientOptions.tenantId,
554
+ ntpId: this.clientOptions.ntpId,
555
+ code,
556
+ email: subject
557
+ });
564
558
 
565
- this.ticketInitialized = true;
566
- this.clientOptions.ticketCode = code;
567
- this.originalParameters.clientOptions.client = this.clientOptions.client;
568
- 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;
569
563
 
570
- this.Initialize(this.target);
571
- })
572
- );
564
+ this.Initialize(this.target);
565
+ });
573
566
 
574
567
  return;
575
568
  }
576
569
 
577
570
  let { protocol, drm, playoutUrl, drms, multiviewOptions } = await playoutOptionsPromise;
578
571
 
572
+ if(["fairplay", "sample-aes"].includes(drm)) {
573
+ // Switch to default controls if using fairplay or sample aes
574
+ if(this.playerOptions.controls !== EluvioPlayerParameters.controls.OFF) {
575
+ this.playerOptions.controls = EluvioPlayerParameters.controls.DEFAULT;
576
+ this.video.controls = true;
577
+ }
578
+ }
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
+
579
583
  multiviewOptions.target = this.target;
580
584
 
581
585
  playoutUrl = URI(playoutUrl);
@@ -584,9 +588,9 @@ export class EluvioPlayer {
584
588
  playoutUrl.query(true).authorization;
585
589
 
586
590
  if(protocol === "hls") {
587
- await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise});
591
+ await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
588
592
  } else {
589
- await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise});
593
+ await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
590
594
  }
591
595
 
592
596
  if(this.playerOptions.playerCallback) {
@@ -625,18 +629,22 @@ export class EluvioPlayer {
625
629
  }
626
630
  }
627
631
 
628
- async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions, controlsPromise}) {
632
+ async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions}) {
629
633
  const HLSPlayer = (await import("hls-fix")).default;
630
634
 
631
635
  if(drm === "fairplay") {
632
636
  InitializeFairPlayStream({playoutOptions: this.sourceOptions.playoutOptions, video: this.video});
633
637
 
634
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
638
+ if(multiviewOptions.enabled) {
639
+ this.controls.InitializeMultiViewControls(multiviewOptions);
640
+ }
635
641
  this.UpdateTextTracks();
636
642
  } else if(!HLSPlayer.isSupported() || drm === "sample-aes") {
637
643
  this.video.src = playoutUrl.toString();
638
644
 
639
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
645
+ if(multiviewOptions.enabled) {
646
+ this.controls.InitializeMultiViewControls(multiviewOptions);
647
+ }
640
648
  } else {
641
649
  playoutUrl.removeQuery("authorization");
642
650
 
@@ -668,7 +676,7 @@ export class EluvioPlayer {
668
676
  hlsPlayer.nextLevel = hlsPlayer.currentLevel;
669
677
  };
670
678
 
671
- controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions));
679
+ this.controls.InitializeMultiViewControls(multiviewOptions);
672
680
  }
673
681
 
674
682
  if(this.controls) {
@@ -776,7 +784,7 @@ export class EluvioPlayer {
776
784
  }
777
785
  }
778
786
 
779
- async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions, controlsPromise}) {
787
+ async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions}) {
780
788
  const DashPlayer = (await import("dashjs")).default;
781
789
  const dashPlayer = DashPlayer.MediaPlayer().create();
782
790
 
@@ -820,7 +828,9 @@ export class EluvioPlayer {
820
828
  this.playerOptions.autoplay === EluvioPlayerParameters.autoplay.ON
821
829
  );
822
830
 
823
- if(multiviewOptions.enabled) { controlsPromise.then(() => this.controls.InitializeMultiViewControls(multiviewOptions)); }
831
+ if(multiviewOptions.enabled) {
832
+ this.controls.InitializeMultiViewControls(multiviewOptions);
833
+ }
824
834
 
825
835
  const UpdateQualityOptions = () => {
826
836
  try {