@eluvio/elv-player-js 2.1.23 → 2.1.25
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 +15 -15
- package/dist/{dash.all.min-DYh-xtyO.js → dash.all.min-C2TzESo8.js} +1 -1
- package/dist/{dash.all.min-aaZCEOSV.mjs → dash.all.min-DiKkCxTo.mjs} +1 -1
- package/dist/elv-player-js.cjs.js +1 -1
- package/dist/elv-player-js.es.js +1 -1
- package/dist/{index-Bu8RooFf.js → index-Bog78gB2.js} +4 -4
- package/dist/{index-C__cMaw8.js → index-CpOffoCC.js} +1 -1
- package/dist/{index-Bd6cLBah.mjs → index-De5RSRMm.mjs} +76 -29
- package/dist/{index-rlrY8g1m.mjs → index-bl4NgMQP.mjs} +1 -1
- package/lib/player/Player.js +74 -12
- package/lib/player/PlayerParameters.js +1 -0
- package/lib/player/ThumbnailHandler.js +2 -2
- package/package.json +1 -1
package/lib/player/Player.js
CHANGED
|
@@ -160,18 +160,19 @@ export class EluvioPlayer {
|
|
|
160
160
|
let options = {
|
|
161
161
|
ignore_trimming: playoutParameters.ignoreTrimming,
|
|
162
162
|
resolve: playoutParameters.resolve,
|
|
163
|
-
...(playoutParameters.options || {})
|
|
163
|
+
...(playoutParameters.options || {}),
|
|
164
|
+
clip_start: (playoutParameters.options || {}).clip_start || playoutParameters.clipStart,
|
|
165
|
+
clip_end: (playoutParameters.options || {}).clip_end || playoutParameters.clipEnd,
|
|
164
166
|
};
|
|
165
167
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
let clipStart, clipEnd;
|
|
169
|
+
if(options.clip_start || options.clip_end) {
|
|
170
|
+
clipStart = parseFloat(options.clip_start || 0);
|
|
171
|
+
clipEnd = parseFloat(options.clip_end || 0);
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
options.clip_start = options.clip_start || 0;
|
|
174
|
-
options.clip_end = options.clip_end || 9999999;
|
|
173
|
+
// These may need to be adjusted due to content trimming later
|
|
174
|
+
delete options.clip_start;
|
|
175
|
+
delete options.clip_end;
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
if(!playoutParameters.channel) {
|
|
@@ -203,8 +204,6 @@ export class EluvioPlayer {
|
|
|
203
204
|
|
|
204
205
|
offeringURI = availableOfferings[offeringId].uri;
|
|
205
206
|
|
|
206
|
-
|
|
207
|
-
|
|
208
207
|
if(this.sourceOptions.contentInfo.liveDVR === EluvioPlayerParameters.liveDVR.ON && offeringProperties.dvr_available) {
|
|
209
208
|
options.dvr = 1;
|
|
210
209
|
this.dvrAvailable = true;
|
|
@@ -215,6 +214,68 @@ export class EluvioPlayer {
|
|
|
215
214
|
this.isLive = offeringProperties.live;
|
|
216
215
|
}
|
|
217
216
|
|
|
217
|
+
const GetPlayoutOptions = async options => {
|
|
218
|
+
if(playoutParameters.directLink) {
|
|
219
|
+
return await client.PlayoutOptions({
|
|
220
|
+
offeringURI,
|
|
221
|
+
options
|
|
222
|
+
});
|
|
223
|
+
} else {
|
|
224
|
+
return await client.PlayoutOptions({
|
|
225
|
+
...playoutParameters,
|
|
226
|
+
handler: playoutParameters.channel ? "channel" : "playout",
|
|
227
|
+
offering: playoutParameters.channel || offeringId,
|
|
228
|
+
options
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
if(!this.sourceOptions.playoutOptions) {
|
|
234
|
+
let playoutOptions;
|
|
235
|
+
|
|
236
|
+
if(!clipStart && !clipEnd) {
|
|
237
|
+
// No clipping
|
|
238
|
+
playoutOptions = await GetPlayoutOptions(options);
|
|
239
|
+
} else if(!playoutParameters.clipRelativeToUntrimmed) {
|
|
240
|
+
// Clip without considering trimming
|
|
241
|
+
playoutOptions = await GetPlayoutOptions({
|
|
242
|
+
...options,
|
|
243
|
+
clip_start: clipStart,
|
|
244
|
+
clip_end: clipEnd
|
|
245
|
+
});
|
|
246
|
+
} else {
|
|
247
|
+
// Content may be trimmed - get full content to determine start offset and adjust clip points accordingly
|
|
248
|
+
playoutOptions = await GetPlayoutOptions(options);
|
|
249
|
+
|
|
250
|
+
let offset;
|
|
251
|
+
try {
|
|
252
|
+
for(const protocol of Object.keys(playoutOptions || {})) {
|
|
253
|
+
for(const drm of Object.keys(playoutOptions[protocol].playoutMethods || {})) {
|
|
254
|
+
if(typeof (playoutOptions[protocol].playoutMethods[drm].properties || {}).start_offset_float !== "undefined") {
|
|
255
|
+
offset = parseFloat(playoutOptions[protocol].playoutMethods[drm].properties.start_offset_float);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if(typeof offset !== "undefined") {
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
} catch(error) {
|
|
265
|
+
this.Log("Failed to load content offset for clip adjustment:");
|
|
266
|
+
this.Log(error, true);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
playoutOptions = await GetPlayoutOptions({
|
|
270
|
+
...options,
|
|
271
|
+
clip_start: (clipStart || 0) - (offset || 0),
|
|
272
|
+
clip_end: ((clipEnd || 0) - (offset || 0)) || 9999999
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
this.sourceOptions.playoutOptions = playoutOptions;
|
|
277
|
+
}
|
|
278
|
+
|
|
218
279
|
if(playoutParameters.directLink) {
|
|
219
280
|
if(!this.sourceOptions.playoutOptions) {
|
|
220
281
|
this.sourceOptions.playoutOptions = await client.PlayoutOptions({
|
|
@@ -491,6 +552,7 @@ export class EluvioPlayer {
|
|
|
491
552
|
versionHash,
|
|
492
553
|
offering,
|
|
493
554
|
compositionKey,
|
|
555
|
+
trimOffset,
|
|
494
556
|
clipStart,
|
|
495
557
|
clipEnd
|
|
496
558
|
};
|
|
@@ -577,7 +639,7 @@ export class EluvioPlayer {
|
|
|
577
639
|
if(this.thumbnailTrackUrl) {
|
|
578
640
|
this.thumbnailHandler = new ThumbnailHandler(
|
|
579
641
|
this.thumbnailTrackUrl,
|
|
580
|
-
|
|
642
|
+
trimOffset || 0
|
|
581
643
|
);
|
|
582
644
|
this.thumbnailHandler.LoadThumbnails()
|
|
583
645
|
.then(() => {
|
|
@@ -59,8 +59,8 @@ const FormatVTTCue = ({label, cue, offset=0}) => {
|
|
|
59
59
|
tagId,
|
|
60
60
|
tagType: "vtt",
|
|
61
61
|
label,
|
|
62
|
-
startTime: cue.startTime
|
|
63
|
-
endTime: cue.endTime
|
|
62
|
+
startTime: cue.startTime - offset,
|
|
63
|
+
endTime: cue.endTime - offset,
|
|
64
64
|
text: cue.text,
|
|
65
65
|
tag: cueCopy
|
|
66
66
|
});
|