@eluvio/elv-player-js 1.0.94 → 1.0.95
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/index.js +49 -18
- package/src/static/stylesheets/player.scss +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -582,14 +582,6 @@ export class EluvioPlayer {
|
|
|
582
582
|
|
|
583
583
|
let { protocol, drm, playoutUrl, drms, multiviewOptions } = await playoutOptionsPromise;
|
|
584
584
|
|
|
585
|
-
if(["fairplay", "sample-aes"].includes(drm)) {
|
|
586
|
-
// Switch to default controls if using fairplay or sample aes
|
|
587
|
-
if(this.playerOptions.controls !== EluvioPlayerParameters.controls.OFF) {
|
|
588
|
-
this.playerOptions.controls = EluvioPlayerParameters.controls.DEFAULT;
|
|
589
|
-
this.video.controls = true;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
585
|
this.controls = new PlayerControls({
|
|
594
586
|
target: this.target,
|
|
595
587
|
video: this.video,
|
|
@@ -653,20 +645,59 @@ export class EluvioPlayer {
|
|
|
653
645
|
async InitializeHLS({playoutUrl, authorizationToken, drm, multiviewOptions}) {
|
|
654
646
|
const HLSPlayer = (await import("hls-fix")).default;
|
|
655
647
|
|
|
656
|
-
if(
|
|
657
|
-
|
|
648
|
+
if(["fairplay", "sample-aes"].includes(drm) || !HLSPlayer.isSupported()) {
|
|
649
|
+
// HLS JS NOT SUPPORTED - Handle native player
|
|
658
650
|
|
|
659
|
-
if(
|
|
660
|
-
this.
|
|
651
|
+
if(drm === "fairplay") {
|
|
652
|
+
InitializeFairPlayStream({playoutOptions: this.sourceOptions.playoutOptions, video: this.video});
|
|
653
|
+
} else {
|
|
654
|
+
this.video.src = playoutUrl.toString();
|
|
661
655
|
}
|
|
662
|
-
this.UpdateTextTracks();
|
|
663
|
-
} else if(!HLSPlayer.isSupported() || drm === "sample-aes") {
|
|
664
|
-
this.video.src = playoutUrl.toString();
|
|
665
656
|
|
|
666
657
|
if(multiviewOptions.enabled) {
|
|
667
|
-
|
|
658
|
+
const Switch = multiviewOptions.SwitchView;
|
|
659
|
+
|
|
660
|
+
multiviewOptions.SwitchView = async (view) => {
|
|
661
|
+
await Switch(view);
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
if(this.controls) {
|
|
665
|
+
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
const UpdateAudioTracks = () => {
|
|
670
|
+
if(this.video.audioTracks.length <= 1) { return; }
|
|
671
|
+
|
|
672
|
+
this.controls.SetAudioTrackControls({
|
|
673
|
+
GetAudioTracks: () => {
|
|
674
|
+
const tracks = Array.from(this.video.audioTracks).map(track => ({
|
|
675
|
+
index: track.id,
|
|
676
|
+
label: track.label || track.language,
|
|
677
|
+
active: track.enabled,
|
|
678
|
+
activeLabel: `Audio: ${track.label || track.language}`
|
|
679
|
+
}));
|
|
680
|
+
|
|
681
|
+
return {label: "Audio Track", options: tracks};
|
|
682
|
+
},
|
|
683
|
+
SetAudioTrack: index => {
|
|
684
|
+
Array.from(this.video.audioTracks).forEach(track =>
|
|
685
|
+
track.enabled = index.toString() === track.id
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// Set up audio and subtitle tracks
|
|
692
|
+
if(this.controls) {
|
|
693
|
+
this.video.textTracks.addEventListener("addtrack", this.UpdateTextTracks());
|
|
694
|
+
this.video.textTracks.addEventListener("removetrack", this.UpdateTextTracks());
|
|
695
|
+
this.video.audioTracks.addEventListener("addtrack", UpdateAudioTracks);
|
|
696
|
+
this.video.audioTracks.addEventListener("removetrack", UpdateAudioTracks);
|
|
668
697
|
}
|
|
669
698
|
} else {
|
|
699
|
+
// HLS JS
|
|
700
|
+
|
|
670
701
|
playoutUrl.removeQuery("authorization");
|
|
671
702
|
|
|
672
703
|
// Inject
|
|
@@ -689,7 +720,7 @@ export class EluvioPlayer {
|
|
|
689
720
|
hlsPlayer.loadSource(playoutUrl.toString());
|
|
690
721
|
hlsPlayer.attachMedia(this.video);
|
|
691
722
|
|
|
692
|
-
if(multiviewOptions.enabled) {
|
|
723
|
+
if(this.controls && multiviewOptions.enabled) {
|
|
693
724
|
const Switch = multiviewOptions.SwitchView;
|
|
694
725
|
|
|
695
726
|
multiviewOptions.SwitchView = async (view) => {
|
|
@@ -854,7 +885,7 @@ export class EluvioPlayer {
|
|
|
854
885
|
this.playerOptions.autoplay === EluvioPlayerParameters.autoplay.ON
|
|
855
886
|
);
|
|
856
887
|
|
|
857
|
-
if(multiviewOptions.enabled) {
|
|
888
|
+
if(this.controls && multiviewOptions.enabled) {
|
|
858
889
|
this.controls.InitializeMultiViewControls(multiviewOptions);
|
|
859
890
|
}
|
|
860
891
|
|