@eluvio/elv-player-js 2.0.23 → 2.0.24
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/dist/.vite/manifest.json +17 -17
- package/dist/{Analytics-CDXMirgj.js → Analytics-B0y2dvhs.js} +1 -1
- package/dist/{Analytics-B72tGTQx.mjs → Analytics-DJ_v0bIw.mjs} +1 -1
- package/dist/{dash.all.min-3hdqLcqd.js → dash.all.min-BFqp01gO.js} +1 -1
- package/dist/{dash.all.min-DlSRaJ_5.mjs → dash.all.min-Bsq3_rAF.mjs} +1 -1
- package/dist/elv-player-js.cjs.js +1 -1
- package/dist/elv-player-js.es.js +1 -1
- package/dist/{index-CO76930D.js → index-CWpTu79Y.js} +1 -1
- package/dist/{index-BrZn3sD8.mjs → index-TLjW30UD.mjs} +1 -1
- package/dist/{index-BxTtC119.mjs → index-icVCF-A6.mjs} +3249 -3244
- package/dist/{index-Be7Zq2Nh.js → index-yaG_tNvS.js} +55 -55
- package/lib/player/Cast.js +16 -10
- package/lib/player/Player.js +28 -18
- package/lib/ui/Observers.js +1 -1
- package/lib/ui/WebControls.jsx +1 -1
- package/package.json +1 -1
package/lib/player/Cast.js
CHANGED
|
@@ -7,17 +7,23 @@ class Cast {
|
|
|
7
7
|
this.onReady = onReady;
|
|
8
8
|
this.connected = false;
|
|
9
9
|
this.playbackRate = 1;
|
|
10
|
-
|
|
11
|
-
window["__onGCastApiAvailable"] = isAvailable =>
|
|
12
|
-
isAvailable && this.Initialize();
|
|
13
|
-
|
|
14
|
-
window.CastController = this;
|
|
15
|
-
|
|
16
10
|
this.__listeners = [];
|
|
17
|
-
|
|
18
11
|
this.onUpdate = onUpdate;
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
if(window.__chromecastAvailable || (window.chrome && window.chrome.cast)) {
|
|
14
|
+
// Chromecast already initialized
|
|
15
|
+
this.Initialize();
|
|
16
|
+
} else {
|
|
17
|
+
// Initialize chromecast script
|
|
18
|
+
window["__onGCastApiAvailable"] = isAvailable => {
|
|
19
|
+
if(isAvailable) {
|
|
20
|
+
window.__chromecastAvailable = true;
|
|
21
|
+
this.Initialize();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
this.LoadScript();
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
LoadScript() {
|
|
@@ -68,7 +74,7 @@ class Cast {
|
|
|
68
74
|
async SetMedia({playoutOptions, playoutParameters}) {
|
|
69
75
|
// Get dash options
|
|
70
76
|
let dashOptions = ((playoutOptions || {}).dash || {}).playoutMethods || {};
|
|
71
|
-
let options = dashOptions.clear
|
|
77
|
+
let options = dashOptions.clear;
|
|
72
78
|
|
|
73
79
|
if(!options) {
|
|
74
80
|
// Dash options might be available under the default_dash offering
|
|
@@ -79,7 +85,7 @@ class Cast {
|
|
|
79
85
|
});
|
|
80
86
|
|
|
81
87
|
dashOptions = ((playoutOptions || {}).dash || {}).playoutMethods || {};
|
|
82
|
-
options = dashOptions.clear ||
|
|
88
|
+
options = dashOptions.clear || {};
|
|
83
89
|
} catch(error) {
|
|
84
90
|
this.player.Log("Unable to find dash playout options for chromecast");
|
|
85
91
|
}
|
package/lib/player/Player.js
CHANGED
|
@@ -7,6 +7,8 @@ import {MergeDefaultParameters} from "../ui/Common";
|
|
|
7
7
|
|
|
8
8
|
const isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
9
9
|
|
|
10
|
+
const chromecastAvailable = window.__chromecastAvailable || !!(window.chrome && window.chrome.cast);
|
|
11
|
+
|
|
10
12
|
const PlayerProfiles = {
|
|
11
13
|
default: {
|
|
12
14
|
label: "Default",
|
|
@@ -60,8 +62,12 @@ export class EluvioPlayer {
|
|
|
60
62
|
this.behindLiveEdge = false;
|
|
61
63
|
this.publicMetadataUrl = undefined;
|
|
62
64
|
this.airplayAvailable = false;
|
|
63
|
-
this.chromecastAvailable =
|
|
65
|
+
this.chromecastAvailable = chromecastAvailable;
|
|
64
66
|
this.casting = false;
|
|
67
|
+
this.usePlayerControls = [
|
|
68
|
+
EluvioPlayerParameters.controls.ON,
|
|
69
|
+
EluvioPlayerParameters.controls.AUTO_HIDE
|
|
70
|
+
].includes(parameters.playerOptions.controls);
|
|
65
71
|
|
|
66
72
|
try {
|
|
67
73
|
// If custom HLS parameters are specified, set profile to custom
|
|
@@ -342,17 +348,19 @@ export class EluvioPlayer {
|
|
|
342
348
|
}
|
|
343
349
|
}
|
|
344
350
|
|
|
345
|
-
// Handle Chromecast
|
|
346
|
-
this.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
// Handle Chromecast (Only if player controls will be visible)
|
|
352
|
+
if(this.usePlayerControls) {
|
|
353
|
+
this.castHandler = new Cast({
|
|
354
|
+
player: this,
|
|
355
|
+
onReady: () => {
|
|
356
|
+
this.chromecastAvailable = true;
|
|
357
|
+
this.__SettingsUpdate();
|
|
358
|
+
},
|
|
359
|
+
onUpdate: () => {
|
|
360
|
+
this.__SettingsUpdate();
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
356
364
|
|
|
357
365
|
// Detect Airplay availability
|
|
358
366
|
this.__RegisterVideoEventListener("webkitplaybacktargetavailabilitychanged", event => {
|
|
@@ -407,10 +415,12 @@ export class EluvioPlayer {
|
|
|
407
415
|
|
|
408
416
|
this.playoutUrl = playoutUrl.toString();
|
|
409
417
|
|
|
410
|
-
this.castHandler
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
if(this.castHandler) {
|
|
419
|
+
this.castHandler.SetMedia({
|
|
420
|
+
playoutOptions: this.sourceOptions.playoutOptions,
|
|
421
|
+
playoutParameters
|
|
422
|
+
});
|
|
423
|
+
}
|
|
414
424
|
|
|
415
425
|
if(this.__destroyed) { return; }
|
|
416
426
|
|
|
@@ -1026,7 +1036,7 @@ export class EluvioPlayer {
|
|
|
1026
1036
|
}
|
|
1027
1037
|
|
|
1028
1038
|
__DestroyPlayer() {
|
|
1029
|
-
this.castHandler.Disconnect();
|
|
1039
|
+
this.castHandler && this.castHandler.Disconnect();
|
|
1030
1040
|
this.__destroyed = true;
|
|
1031
1041
|
this.__Reset();
|
|
1032
1042
|
}
|
|
@@ -1086,7 +1096,7 @@ export class EluvioPlayer {
|
|
|
1086
1096
|
this.dvrEnabled = false;
|
|
1087
1097
|
this.publicMetadataUrl = undefined;
|
|
1088
1098
|
this.airplayAvailable = false;
|
|
1089
|
-
this.chromecastAvailable =
|
|
1099
|
+
this.chromecastAvailable = chromecastAvailable;
|
|
1090
1100
|
this.casting = false;
|
|
1091
1101
|
}
|
|
1092
1102
|
|
package/lib/ui/Observers.js
CHANGED
|
@@ -85,7 +85,7 @@ export const ObserveVideo = ({player, setVideoState}) => {
|
|
|
85
85
|
events.map(event => player.video.addEventListener(event, UpdateVideoState));
|
|
86
86
|
player.target.addEventListener("fullscreenchange", UpdateVideoState);
|
|
87
87
|
|
|
88
|
-
const castListenerDisposer = player.castHandler.RegisterListener(UpdateVideoState);
|
|
88
|
+
const castListenerDisposer = player.castHandler && player.castHandler.RegisterListener(UpdateVideoState);
|
|
89
89
|
|
|
90
90
|
return () => {
|
|
91
91
|
events.map(event => player.video.removeEventListener(event, UpdateVideoState));
|
package/lib/ui/WebControls.jsx
CHANGED