@eluvio/elv-player-js 2.0.35 → 2.0.37

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.
@@ -17,7 +17,8 @@ export const InitializeMuxMonitoring = async ({
17
17
 
18
18
  const versionHash = playoutUrl.pathname.split("/").find(token => token.startsWith("hq__"));
19
19
  const objectId = client.utils.DecodeVersionHash(versionHash).objectId;
20
- const offering = playoutUrl.toString().match(/\/rep\/playout\/([^/]+)/)[1] || "default";
20
+
21
+ const offering = (playoutUrl.toString().match(/\/rep\/playout|channel\/([^/]+)/) || [])[1] || "default";
21
22
  const sessionId = playoutUrl.searchParams.get("sid");
22
23
 
23
24
  let name = versionHash;
@@ -145,7 +145,12 @@ export class EluvioPlayer {
145
145
  this.sourceOptions.playoutOptions = undefined;
146
146
  }
147
147
 
148
- let offeringId, offeringURI, options = {};
148
+ let offeringId, offeringURI;
149
+ let options = {
150
+ ignore_trimming: playoutParameters.ignoreTrimming,
151
+ resolve: playoutParameters.resolve
152
+ };
153
+
149
154
  if(playoutParameters.clipStart || playoutParameters.clipEnd) {
150
155
  options.clip_start = parseFloat(playoutParameters.clipStart || 0);
151
156
 
@@ -153,48 +158,46 @@ export class EluvioPlayer {
153
158
  options.clip_end = parseFloat(playoutParameters.clipEnd);
154
159
  }
155
160
  }
156
-
157
- let availableOfferings = (await client.AvailableOfferings({
158
- objectId: playoutParameters.objectId,
159
- versionHash: playoutParameters.versionHash,
160
- writeToken: playoutParameters.writeToken,
161
- linkPath: playoutParameters.linkPath,
162
- directLink: playoutParameters.directLink,
163
- resolveIncludeSource: true,
164
- authorizationToken: playoutParameters.authorizationToken
165
- })) || {};
166
-
167
- offeringId = availableOfferings.default ? "default" :Object.keys(availableOfferings)[0];
168
- if(playoutParameters.offering) {
169
- offeringId = availableOfferings[playoutParameters.offering] ? playoutParameters.offering : undefined;
170
- } else if((playoutParameters.offerings || []).length > 0) {
171
- offeringId = playoutParameters.offerings.find(offeringId => availableOfferings[offeringId]);
172
- } else if(playoutParameters.offerings && playoutParameters.offerings.length > 0) {
173
- offeringId = playoutParameters.offerings.find(offeringId => availableOfferings[offeringId]);
174
- }
175
161
 
176
- if(!offeringId) {
177
- throw new Error(`Unable to find offering from '${playoutParameters.offering || playoutParameters.offerings}'`);
178
- }
162
+ if(!playoutParameters.channel) {
163
+ // Determine offering
164
+ let availableOfferings = (await client.AvailableOfferings({
165
+ objectId: playoutParameters.objectId,
166
+ versionHash: playoutParameters.versionHash,
167
+ writeToken: playoutParameters.writeToken,
168
+ linkPath: playoutParameters.linkPath,
169
+ directLink: playoutParameters.directLink,
170
+ resolveIncludeSource: true,
171
+ authorizationToken: playoutParameters.authorizationToken
172
+ })) || {};
173
+
174
+ offeringId = availableOfferings.default ? "default" : Object.keys(availableOfferings)[0];
175
+ if(playoutParameters.offering) {
176
+ offeringId = availableOfferings[playoutParameters.offering] ? playoutParameters.offering : undefined;
177
+ } else if((playoutParameters.offerings || []).length > 0) {
178
+ offeringId = playoutParameters.offerings.find(offeringId => availableOfferings[offeringId]);
179
+ } else if(playoutParameters.offerings && playoutParameters.offerings.length > 0) {
180
+ offeringId = playoutParameters.offerings.find(offeringId => availableOfferings[offeringId]);
181
+ }
179
182
 
180
- const offeringProperties = availableOfferings[offeringId] && availableOfferings[offeringId].properties || {};
183
+ if(!offeringId) {
184
+ throw new Error(`Unable to find offering from '${playoutParameters.offering || playoutParameters.offerings}'`);
185
+ }
181
186
 
182
- offeringURI = availableOfferings[offeringId].uri;
187
+ const offeringProperties = availableOfferings[offeringId] && availableOfferings[offeringId].properties || {};
183
188
 
184
- options.ignore_trimming = playoutParameters.ignoreTrimming;
185
- options.resolve = playoutParameters.resolve;
189
+ offeringURI = availableOfferings[offeringId].uri;
186
190
 
187
- if(this.sourceOptions.contentInfo.liveDVR === EluvioPlayerParameters.liveDVR.ON && offeringProperties.dvr_available) {
188
- options.dvr = 1;
189
- this.dvrAvailable = true;
190
- } else {
191
- this.dvrAvailable = false;
192
- }
193
191
 
194
- if(offeringProperties.live) {
195
- this.isLive = true;
196
- } else {
197
- this.isLive = false;
192
+
193
+ if(this.sourceOptions.contentInfo.liveDVR === EluvioPlayerParameters.liveDVR.ON && offeringProperties.dvr_available) {
194
+ options.dvr = 1;
195
+ this.dvrAvailable = true;
196
+ } else {
197
+ this.dvrAvailable = false;
198
+ }
199
+
200
+ this.isLive = offeringProperties.live;
198
201
  }
199
202
 
200
203
  if(playoutParameters.directLink) {
@@ -208,7 +211,8 @@ export class EluvioPlayer {
208
211
  if(!this.sourceOptions.playoutOptions) {
209
212
  this.sourceOptions.playoutOptions = await client.PlayoutOptions({
210
213
  ...playoutParameters,
211
- offering: offeringId,
214
+ handler: playoutParameters.channel ? "channel" : "playout",
215
+ offering: playoutParameters.channel || offeringId,
212
216
  options
213
217
  });
214
218
  }
@@ -224,7 +228,11 @@ export class EluvioPlayer {
224
228
 
225
229
  drm =
226
230
  (this.sourceOptions.drms || []).length === 0 ? (protocolDRMs.find(drm => drm !== "clear")) || protocolDRMs[0] :
227
- this.sourceOptions.drms.find(drm => availableDRMs.includes(drm) && this.sourceOptions.playoutOptions[protocol].playoutMethods[drm]);
231
+ this.sourceOptions.drms
232
+ .sort()
233
+ // Prefer widevine if available
234
+ .reverse()
235
+ .find(drm => availableDRMs.includes(drm) && this.sourceOptions.playoutOptions[protocol].playoutMethods[drm]);
228
236
 
229
237
  if(!drm) {
230
238
  availableProtocols = availableProtocols.filter(p => p !== protocol);
@@ -564,7 +572,11 @@ export class EluvioPlayer {
564
572
  this.HLS = (await import("hls.js")).default;
565
573
 
566
574
  const nativeHLSSupported = this.video.canPlayType("application/vnd.apple.mpegURL");
567
- if((nativeHLSSupported && isIOS) || [EluvioPlayerParameters.drms.FAIRPLAY, EluvioPlayerParameters.drms.SAMPLE_AES].includes(drm) || !this.HLS.isSupported()) {
575
+ if(
576
+ (nativeHLSSupported && isIOS && this.playerOptions.preferNativeHLS) ||
577
+ [EluvioPlayerParameters.drms.FAIRPLAY, EluvioPlayerParameters.drms.SAMPLE_AES].includes(drm) ||
578
+ !this.HLS.isSupported()
579
+ ) {
568
580
  // HLS JS NOT SUPPORTED - Handle native player
569
581
  this.nativeHLS = true;
570
582
 
@@ -1006,6 +1018,7 @@ export class EluvioPlayer {
1006
1018
 
1007
1019
  const objectId = client.utils.DecodeVersionHash(this.contentHash).objectId;
1008
1020
  const tenantId = await client.ContentObjectTenantId({objectId});
1021
+ const contentSpaceId = await client.ContentSpaceId();
1009
1022
 
1010
1023
  let tenantName, lastCommittedAt, versionCount;
1011
1024
  try {
@@ -1032,7 +1045,7 @@ export class EluvioPlayer {
1032
1045
 
1033
1046
  try {
1034
1047
  tenantName = await client.ContentObjectMetadata({
1035
- libraryId: client.contentSpaceLibraryId,
1048
+ libraryId: contentSpaceId.replace("ispc", "ilib"),
1036
1049
  objectId: tenantId.replace("iten", "iq__"),
1037
1050
  metadataSubtree: "/public/name"
1038
1051
  });
@@ -100,6 +100,10 @@ export const PlayerParameters = {
100
100
  allowCasting: {
101
101
  OFF: false,
102
102
  ON: true
103
+ },
104
+ preferNativeHLS: {
105
+ OFF: false,
106
+ ON: true
103
107
  }
104
108
  };
105
109
 
@@ -149,6 +153,7 @@ export const DefaultParameters = {
149
153
  handler: "playout",
150
154
  offering: undefined,
151
155
  offerings: [],
156
+ channel: undefined,
152
157
  playoutType: undefined,
153
158
  context: undefined,
154
159
  hlsjsProfile: true,
@@ -176,6 +181,7 @@ export const DefaultParameters = {
176
181
  showLoader: PlayerParameters.showLoader.ON,
177
182
  permanentPoster: PlayerParameters.permanentPoster.OFF,
178
183
  allowCasting: PlayerParameters.allowCasting.ON,
184
+ preferNativeHLS: PlayerParameters.preferNativeHLS.ON,
179
185
  startTime: undefined,
180
186
  startProgress: undefined,
181
187
  hlsjsOptions: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.35",
3
+ "version": "2.0.37",
4
4
  "description": "![Eluvio Logo](lib/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "dist/elv-player-js.es.js",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "package-lock.json"
37
37
  ],
38
38
  "dependencies": {
39
- "@eluvio/elv-client-js": "^4.0.111",
39
+ "@eluvio/elv-client-js": "^4.0.123",
40
40
  "dashjs": "~4.7.0",
41
41
  "focus-visible": "^5.2.0",
42
42
  "hls.js": "~1.5.12",