@eluvio/elv-player-js 1.0.89 → 1.0.91
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 +1 -1
- package/src/PlayerControls.js +16 -8
- package/src/index.js +42 -35
package/package.json
CHANGED
package/src/PlayerControls.js
CHANGED
|
@@ -108,10 +108,25 @@ const Time = (time, total) => {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
class PlayerControls {
|
|
111
|
-
constructor(target, video, playerOptions, posterUrl, className) {
|
|
111
|
+
constructor({target, video, playerOptions, posterUrl, className}) {
|
|
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,51 @@ 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
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
-
|
|
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({
|
|
581
|
+
target: this.target,
|
|
582
|
+
video: this.video,
|
|
583
|
+
playerOptions: this.playerOptions,
|
|
584
|
+
className: this.playerOptions.controlsClassName
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
this.PosterUrl().then(posterUrl => this.controls.SetPosterUrl(posterUrl));
|
|
588
|
+
|
|
588
589
|
multiviewOptions.target = this.target;
|
|
589
590
|
|
|
590
591
|
playoutUrl = URI(playoutUrl);
|
|
@@ -593,9 +594,9 @@ export class EluvioPlayer {
|
|
|
593
594
|
playoutUrl.query(true).authorization;
|
|
594
595
|
|
|
595
596
|
if(protocol === "hls") {
|
|
596
|
-
await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions
|
|
597
|
+
await this.InitializeHLS({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
|
|
597
598
|
} else {
|
|
598
|
-
await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions
|
|
599
|
+
await this.InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions});
|
|
599
600
|
}
|
|
600
601
|
|
|
601
602
|
if(this.playerOptions.playerCallback) {
|
|
@@ -634,18 +635,22 @@ export class EluvioPlayer {
|
|
|
634
635
|
}
|
|
635
636
|
}
|
|
636
637
|
|
|
637
|
-
async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions
|
|
638
|
+
async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions}) {
|
|
638
639
|
const HLSPlayer = (await import("hls-fix")).default;
|
|
639
640
|
|
|
640
641
|
if(drm === "fairplay") {
|
|
641
642
|
InitializeFairPlayStream({playoutOptions: this.sourceOptions.playoutOptions, video: this.video});
|
|
642
643
|
|
|
643
|
-
if(multiviewOptions.enabled) {
|
|
644
|
+
if(multiviewOptions.enabled) {
|
|
645
|
+
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
646
|
+
}
|
|
644
647
|
this.UpdateTextTracks();
|
|
645
648
|
} else if(!HLSPlayer.isSupported() || drm === "sample-aes") {
|
|
646
649
|
this.video.src = playoutUrl.toString();
|
|
647
650
|
|
|
648
|
-
if(multiviewOptions.enabled) {
|
|
651
|
+
if(multiviewOptions.enabled) {
|
|
652
|
+
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
653
|
+
}
|
|
649
654
|
} else {
|
|
650
655
|
playoutUrl.removeQuery("authorization");
|
|
651
656
|
|
|
@@ -677,7 +682,7 @@ export class EluvioPlayer {
|
|
|
677
682
|
hlsPlayer.nextLevel = hlsPlayer.currentLevel;
|
|
678
683
|
};
|
|
679
684
|
|
|
680
|
-
|
|
685
|
+
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
681
686
|
}
|
|
682
687
|
|
|
683
688
|
if(this.controls) {
|
|
@@ -785,7 +790,7 @@ export class EluvioPlayer {
|
|
|
785
790
|
}
|
|
786
791
|
}
|
|
787
792
|
|
|
788
|
-
async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions
|
|
793
|
+
async InitializeDash({playoutUrl, authorizationToken, drm, drms, multiviewOptions}) {
|
|
789
794
|
const DashPlayer = (await import("dashjs")).default;
|
|
790
795
|
const dashPlayer = DashPlayer.MediaPlayer().create();
|
|
791
796
|
|
|
@@ -829,7 +834,9 @@ export class EluvioPlayer {
|
|
|
829
834
|
this.playerOptions.autoplay === EluvioPlayerParameters.autoplay.ON
|
|
830
835
|
);
|
|
831
836
|
|
|
832
|
-
if(multiviewOptions.enabled) {
|
|
837
|
+
if(multiviewOptions.enabled) {
|
|
838
|
+
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
839
|
+
}
|
|
833
840
|
|
|
834
841
|
const UpdateQualityOptions = () => {
|
|
835
842
|
try {
|