@tidal-music/player-web-components 0.1.0 → 0.1.2

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.
@@ -1,63 +1,63 @@
1
- import { _ as I, F as T, y as d, l as o, k as r, b as m, P as n, a as h, j as v, n as p, o as b, B as k, G as c, R as f, Q as A, c as g, w as P, d as y } from "./index-tM9JvbA8.js";
2
- function L(s) {
1
+ import { N as I, c as T, b as o, l as d, g as n, T as r, S as m, A as h, G as v, s as p, d as b, f as k, z as c, _ as f, V as A, p as g, h as P, D as y } from "./index-DbGwqQeZ.js";
2
+ function L(i) {
3
3
  return g(
4
4
  () => P(y, {
5
5
  type: "play_log",
6
- ...s
6
+ ...i
7
7
  })
8
8
  );
9
9
  }
10
- function N(s, t) {
10
+ function x(i, e) {
11
11
  return new CustomEvent(
12
12
  "media-product-transition",
13
13
  {
14
14
  detail: {
15
- mediaProduct: s,
16
- playbackContext: t
15
+ mediaProduct: i,
16
+ playbackContext: e
17
17
  }
18
18
  }
19
19
  );
20
20
  }
21
21
  const G = ({
22
- assetPosition: s,
23
- duration: t,
24
- playbackInfo: e,
22
+ assetPosition: i,
23
+ duration: e,
24
+ playbackInfo: t,
25
25
  streamInfo: a
26
26
  }) => ({
27
- actualAssetPresentation: e.assetPresentation,
28
- actualAudioMode: "audioMode" in e ? e.audioMode : null,
29
- actualAudioQuality: "audioQuality" in e ? e.audioQuality : null,
30
- actualDuration: t,
27
+ actualAssetPresentation: t.assetPresentation,
28
+ actualAudioMode: "audioMode" in t ? t.audioMode : null,
29
+ actualAudioQuality: "audioQuality" in t ? t.audioQuality : null,
30
+ actualDuration: e,
31
31
  actualProductId: String(
32
- "videoId" in e ? e.videoId : e.trackId
32
+ "videoId" in t ? t.videoId : t.trackId
33
33
  ),
34
- actualStreamType: "streamType" in e ? e.streamType : null,
35
- actualVideoQuality: "videoQuality" in e ? e.videoQuality : null,
36
- assetPosition: s,
34
+ actualStreamType: "streamType" in t ? t.streamType : null,
35
+ actualVideoQuality: "videoQuality" in t ? t.videoQuality : null,
36
+ assetPosition: i,
37
37
  bitDepth: a.bitDepth ?? null,
38
38
  codec: a.codec ?? null,
39
39
  playbackSessionId: a.streamingSessionId,
40
40
  sampleRate: a.sampleRate ?? null
41
41
  });
42
- function M(s, t) {
42
+ function M(i, e) {
43
43
  return new CustomEvent("ended", {
44
44
  detail: {
45
- mediaProduct: t,
46
- reason: s
45
+ mediaProduct: e,
46
+ reason: i
47
47
  }
48
48
  });
49
49
  }
50
- function E(s) {
50
+ function E(i) {
51
51
  return new CustomEvent("playback-state-change", {
52
52
  detail: {
53
- state: s
53
+ state: i
54
54
  }
55
55
  });
56
56
  }
57
- function R() {
57
+ function _() {
58
58
  return new CustomEvent("preload-request");
59
59
  }
60
- const _ = {
60
+ const w = {
61
61
  playback: {
62
62
  durationMS: 0,
63
63
  id: "",
@@ -68,26 +68,26 @@ const _ = {
68
68
  },
69
69
  type: "TRACK"
70
70
  }
71
- }, w = await I(
71
+ }, R = await I(
72
72
  "progress",
73
- _
73
+ w
74
74
  );
75
- function C(s) {
76
- return w(s);
75
+ function C(i) {
76
+ return R(i);
77
77
  }
78
- function D(s) {
78
+ function D(i) {
79
79
  return g(
80
80
  () => P(y, {
81
- ...s,
81
+ ...i,
82
82
  type: "playback"
83
83
  })
84
84
  );
85
85
  }
86
- function S(s) {
87
- return Math.min(Math.pow(10, (4 + s) / 20), 1 / 1);
86
+ function S(i) {
87
+ return Math.min(Math.pow(10, (4 + i) / 20), 1 / 1);
88
88
  }
89
- function x(s) {
90
- switch (s) {
89
+ function N(i) {
90
+ switch (i) {
91
91
  case "completed":
92
92
  return "COMPLETE";
93
93
  case "error":
@@ -98,9 +98,9 @@ function x(s) {
98
98
  }
99
99
  }
100
100
  class Y {
101
- #t;
102
- #i;
103
101
  #e;
102
+ #i;
103
+ #t;
104
104
  #r = void 0;
105
105
  #n;
106
106
  #s = "IDLE";
@@ -116,7 +116,7 @@ class Y {
116
116
  // Implements
117
117
  #c() {
118
118
  this.duration && Math.abs(this.#i - this.duration) <= 30 && // A false check, rather than undefined, ensures a media product transition hs been made.
119
- this.#r === !1 && (this.#r = !0, d.dispatchEvent(R()));
119
+ this.#r === !1 && (this.#r = !0, o.dispatchEvent(_()));
120
120
  }
121
121
  /**
122
122
  * This method should be call whenever a playback ends, for **whatever** reason.
@@ -124,37 +124,38 @@ class Y {
124
124
  * ended, completed, skip, reset etc
125
125
  */
126
126
  #u({
127
- endAssetPosition: t,
128
- endReason: e,
127
+ endAssetPosition: e,
128
+ endReason: t,
129
129
  streamingSessionId: a
130
130
  }) {
131
- this.debugLog("mediaProductEnded"), o.preloadedStreamingSessionId && performance.mark(
131
+ this.debugLog("mediaProductEnded"), d.preloadedStreamingSessionId && performance.mark(
132
132
  "streaming_metrics:playback_statistics:idealStartTimestamp",
133
133
  {
134
- detail: o.preloadedStreamingSessionId
134
+ detail: d.preloadedStreamingSessionId,
135
+ startTime: n.now()
135
136
  }
136
137
  );
137
- const i = r.getMediaProductTransition(a);
138
- i && d.dispatchEvent(
139
- M(e, i.mediaProduct)
138
+ const s = r.getMediaProductTransition(a);
139
+ s && o.dispatchEvent(
140
+ M(t, s.mediaProduct)
140
141
  ), this.eventTrackingStreamingEnded(a, {
141
- endAssetPosition: t,
142
- endReason: e
142
+ endAssetPosition: e,
143
+ endReason: t
143
144
  }), this.reportPlaybackProgress(a), r.deleteSession(a), this.#a.delete(a), this.currentStreamingSessionId === a && (this.currentStreamingSessionId = void 0), this.updateVolumeLevelForNextProduct();
144
145
  }
145
- adjustedVolume(t) {
146
- const e = m("desiredVolumeLevel"), a = m("loudnessNormalizationMode");
147
- let i = e;
148
- return a === "ALBUM" && t.albumReplayGain && (i *= S(t.albumReplayGain)), a === "TRACK" && t.trackReplayGain && (i *= S(t.trackReplayGain)), this.debugLog(
146
+ adjustedVolume(e) {
147
+ const t = m("desiredVolumeLevel"), a = m("loudnessNormalizationMode");
148
+ let s = t;
149
+ return a === "ALBUM" && e.albumReplayGain && (s *= S(e.albumReplayGain)), a === "TRACK" && e.trackReplayGain && (s *= S(e.trackReplayGain)), this.debugLog(
149
150
  "adjustedVolume",
150
- `Volume adjusted from ${e} to ${i}`
151
- ), parseFloat(i.toFixed(2));
151
+ `Volume adjusted from ${t} to ${s}`
152
+ ), parseFloat(s.toFixed(2));
152
153
  }
153
154
  // Implements
154
155
  attachPlaybackEngineEndedHandler() {
155
- this.#e || (this.#e = this.playbackEngineEndedHandler.bind(this), d.addEventListener(
156
+ this.#t || (this.#t = this.playbackEngineEndedHandler.bind(this), o.addEventListener(
156
157
  "ended",
157
- this.#e
158
+ this.#t
158
159
  ));
159
160
  }
160
161
  /**
@@ -166,72 +167,73 @@ class Y {
166
167
  this.preloadedStreamingSessionId && this.preloadedStreamingSessionId !== this.currentStreamingSessionId && (r.deleteSession(this.preloadedStreamingSessionId), this.preloadedStreamingSessionId = void 0);
167
168
  }
168
169
  // Implements
169
- debugLog(...t) {
170
+ debugLog(...e) {
170
171
  document.location.href.includes("localhost") && document.location.hash.includes("debug") && console.debug(
171
- `[%cPlayerSDK${this.name ? `%c${o.activePlayer?.name === this.name ? "⚯" : "⚮"}%c` + this.name : ""}${this.#t ? "%c::%c" + this.#t?.split("-").pop() : ""}%c]`,
172
+ `[%cPlayerSDK${this.name ? `%c${d.activePlayer?.name === this.name ? "⚯" : "⚮"}%c` + this.name : ""}${this.#e ? "%c::%c" + this.#e?.split("-").pop() : ""}%c]`,
172
173
  "color:#00d6ff",
173
174
  ...this.name ? [
174
175
  "color:inherit",
175
176
  "color:#b7fa34"
176
177
  // green foreground
177
178
  ] : [],
178
- ...this.#t ? [
179
+ ...this.#e ? [
179
180
  "color:inherit",
180
181
  "color:#d947ff"
181
182
  // purple foreground
182
183
  ] : [],
183
184
  "color:inherit",
184
- ...t
185
+ ...e
185
186
  );
186
187
  }
187
188
  detachPlaybackEngineEndedHandler() {
188
- this.#e && (d.removeEventListener(
189
+ this.#t && (o.removeEventListener(
189
190
  "ended",
190
- this.#e
191
- ), this.#e = void 0);
191
+ this.#t
192
+ ), this.#t = void 0);
192
193
  }
193
194
  /**
194
195
  * Commits play_log playbackSession and streaming_metrics playbackStatistics.
195
196
  *
196
197
  * @param streamingSessionId
197
198
  */
198
- eventTrackingStreamingEnded(t, {
199
- endAssetPosition: e,
199
+ eventTrackingStreamingEnded(e, {
200
+ endAssetPosition: t,
200
201
  endReason: a
201
202
  }) {
202
- const i = n.now();
203
+ const s = n.now();
203
204
  L({
204
205
  events: [
205
206
  h({
206
- endAssetPosition: e,
207
- endTimestamp: i,
208
- streamingSessionId: t
207
+ endAssetPosition: t,
208
+ endTimestamp: s,
209
+ streamingSessionId: e
209
210
  })
210
211
  ]
211
212
  }).catch(console.error), v({
212
213
  events: [
213
214
  p({
214
- endReason: x(a),
215
- endTimestamp: i,
216
- streamingSessionId: t
215
+ endReason: N(a),
216
+ endTimestamp: s,
217
+ streamingSessionId: e
217
218
  }),
218
219
  b({
219
- streamingSessionId: t,
220
- timestamp: i
220
+ streamingSessionId: e,
221
+ timestamp: s
221
222
  })
222
223
  ]
223
224
  }).catch(console.error);
224
225
  }
225
- eventTrackingStreamingStarted(t) {
226
- if (!t)
226
+ eventTrackingStreamingStarted(e) {
227
+ if (!e)
227
228
  return;
228
229
  performance.mark(
229
230
  "streaming_metrics:playback_statistics:actualStartTimestamp",
230
231
  {
231
- detail: t
232
+ detail: e,
233
+ startTime: n.now()
232
234
  }
233
235
  ), performance.measure("idealStartTimestamp -> actualStartTimestamp", {
234
- detail: t,
236
+ detail: e,
235
237
  end: "streaming_metrics:playback_statistics:actualStartTimestamp",
236
238
  start: "streaming_metrics:playback_statistics:idealStartTimestamp"
237
239
  });
@@ -239,14 +241,14 @@ class Y {
239
241
  p({
240
242
  actualStartTimestamp: n.timestamp(
241
243
  "streaming_metrics:playback_statistics:actualStartTimestamp",
242
- t
244
+ e
243
245
  ),
244
246
  idealStartTimestamp: n.timestamp(
245
247
  "streaming_metrics:playback_statistics:idealStartTimestamp",
246
- t
248
+ e
247
249
  ),
248
250
  outputDevice: this.#n,
249
- streamingSessionId: t
251
+ streamingSessionId: e
250
252
  });
251
253
  } catch (l) {
252
254
  console.error(
@@ -260,38 +262,40 @@ class Y {
260
262
  "streaming_metrics:playback_statistics:idealStartTimestamp"
261
263
  );
262
264
  }
263
- const e = r.getMediaProductTransition(t);
264
- if (!e) {
265
- this.#a.has(t) ? console.error(
266
- `A media product transition for streaming session #${t} has not been saved and could thus not be found for play log reporting.`
267
- ) : (r.deleteStreamInfo(t), console.warn(
268
- `Streaming session #${t} has been discarded due to a new load. This could mean you have a bug in your code where you call load on Player more than once time in a very short time frame.`
265
+ const t = r.getMediaProductTransition(e);
266
+ if (!t) {
267
+ this.#a.has(e) ? console.error(
268
+ `A media product transition for streaming session #${e} has not been saved and could thus not be found for play log reporting.`
269
+ ) : (r.deleteStreamInfo(e), console.warn(
270
+ `Streaming session #${e} has been discarded due to a new load. This could mean you have a bug in your code where you call load on Player more than once time in a very short time frame.`
269
271
  ));
270
272
  return;
271
273
  }
272
- const { mediaProduct: a, playbackContext: i } = e, u = n.now();
274
+ const { mediaProduct: a, playbackContext: s } = t, u = n.now();
273
275
  h({
274
- actualAssetPresentation: i.actualAssetPresentation,
275
- actualAudioMode: "actualAudioMode" in i ? i.actualAudioMode : null,
276
- actualProductId: i.actualProductId,
277
- actualQuality: i.actualAudioQuality || i.actualVideoQuality,
278
- isPostPaywall: i.actualAssetPresentation === "FULL",
279
- playbackSessionId: t,
276
+ actualAssetPresentation: s.actualAssetPresentation,
277
+ actualAudioMode: "actualAudioMode" in s ? s.actualAudioMode : null,
278
+ actualProductId: s.actualProductId,
279
+ actualQuality: s.actualAudioQuality || s.actualVideoQuality,
280
+ isPostPaywall: s.actualAssetPresentation === "FULL",
281
+ playbackSessionId: e,
280
282
  productType: a.productType === "track" ? "TRACK" : "VIDEO",
281
283
  requestedProductId: a.productId,
282
284
  sourceId: a.sourceId,
283
285
  sourceType: a.sourceType,
284
286
  startAssetPosition: this.startAssetPosition,
285
287
  startTimestamp: u,
286
- streamingSessionId: t
288
+ streamingSessionId: e
287
289
  });
288
290
  }
289
- finishCurrentMediaProduct(t) {
290
- const e = this.#t, a = e ? r.hasStreamInfo(e) : !1;
291
- this.preloadedStreamingSessionId || (this.playbackState = "IDLE"), e && a && this.#u({
291
+ finishCurrentMediaProduct(e) {
292
+ if (!this.hasStarted())
293
+ return;
294
+ const t = this.#e, a = t ? r.hasStreamInfo(t) : !1;
295
+ this.preloadedStreamingSessionId || (this.playbackState = "IDLE"), t && a && this.#u({
292
296
  endAssetPosition: this.currentTime,
293
- endReason: t,
294
- streamingSessionId: e
297
+ endReason: e,
298
+ streamingSessionId: t
295
299
  });
296
300
  }
297
301
  getPosition() {
@@ -300,8 +304,8 @@ class Y {
300
304
  /**
301
305
  * Refetches playbackinfo.
302
306
  */
303
- async hardReload(t, e) {
304
- return k(t, e);
307
+ async hardReload(e, t) {
308
+ return this.currentStreamingSessionId && this.finishCurrentMediaProduct("skip"), k(e, t);
305
309
  }
306
310
  hasNextItem() {
307
311
  return this.preloadedStreamingSessionId && r.hasMediaProductTransition(
@@ -312,7 +316,7 @@ class Y {
312
316
  return this.currentStreamingSessionId && this.#a.has(this.currentStreamingSessionId);
313
317
  }
314
318
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
315
- load(t, e) {
319
+ load(e, t) {
316
320
  return Promise.resolve();
317
321
  }
318
322
  /**
@@ -321,8 +325,8 @@ class Y {
321
325
  * @returns {boolean} True if hard reloaded, else false.
322
326
  */
323
327
  async maybeHardReload() {
324
- const t = this.prefetched || this.expired;
325
- return this.currentMediaProduct && t ? (await this.hardReload(this.currentMediaProduct, 0), !0) : !1;
328
+ const e = this.prefetched || this.expired;
329
+ return this.currentMediaProduct && e ? (await this.hardReload(this.currentMediaProduct, 0), !0) : !1;
326
330
  }
327
331
  /**
328
332
  * This method should be call whenever a playback starts, for **whatever** reason.
@@ -331,11 +335,11 @@ class Y {
331
335
  *
332
336
  * @param streamingSessionId
333
337
  */
334
- mediaProductStarted(t) {
335
- !t || this.#a.has(t) || (this.debugLog("mediaProductStarted"), this.eventTrackingStreamingStarted(t), this.#a.set(t, !0), this.updateVolumeLevel(), this.#r = !1, this.preloadedStreamingSessionId = void 0, this.unloadPreloadedMediaProduct().catch(console.error), this.attachPlaybackEngineEndedHandler());
338
+ mediaProductStarted(e) {
339
+ !e || this.#a.has(e) || (this.debugLog("mediaProductStarted"), this.eventTrackingStreamingStarted(e), this.#a.set(e, !0), this.updateVolumeLevel(), this.#r = !1, this.preloadedStreamingSessionId = void 0, this.unloadPreloadedMediaProduct().catch(console.error), this.attachPlaybackEngineEndedHandler());
336
340
  }
337
341
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
338
- next(t) {
342
+ next(e) {
339
343
  return Promise.resolve();
340
344
  }
341
345
  /**
@@ -346,22 +350,22 @@ class Y {
346
350
  * @param streamingSessionId
347
351
  * @param partialMediaProduct
348
352
  */
349
- overwriteMediaProduct(t, e) {
350
- const a = r.getMediaProductTransition(t);
353
+ overwriteMediaProduct(e, t) {
354
+ const a = r.getMediaProductTransition(e);
351
355
  if (a) {
352
- r.deleteMediaProductTransition(t);
353
- const i = {
356
+ r.deleteMediaProductTransition(e);
357
+ const s = {
354
358
  mediaProduct: {
355
359
  ...a.mediaProduct,
356
- ...e
360
+ ...t
357
361
  },
358
362
  playbackContext: {
359
363
  ...a.playbackContext
360
364
  }
361
365
  };
362
366
  r.saveMediaProductTransition(
363
- t,
364
- i
367
+ e,
368
+ s
365
369
  );
366
370
  }
367
371
  }
@@ -371,19 +375,19 @@ class Y {
371
375
  return Promise.resolve();
372
376
  }
373
377
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
374
- playbackEngineEndedHandler(t) {
378
+ playbackEngineEndedHandler(e) {
375
379
  return Promise.resolve();
376
380
  }
377
- reportPlaybackProgress(t) {
378
- const e = r.getMediaProductTransition(t);
379
- if (!e)
381
+ reportPlaybackProgress(e) {
382
+ const t = r.getMediaProductTransition(e);
383
+ if (!t)
380
384
  return;
381
- const { mediaProduct: a, playbackContext: i } = e;
382
- this.#t && D({
385
+ const { mediaProduct: a, playbackContext: s } = t;
386
+ this.#e && D({
383
387
  events: [
384
388
  C({
385
389
  playback: {
386
- durationMS: Math.floor(i.actualDuration * 1e3),
390
+ durationMS: Math.floor(s.actualDuration * 1e3),
387
391
  id: a.productId,
388
392
  playedMS: Math.floor(this.currentTime * 1e3),
389
393
  source: {
@@ -392,42 +396,59 @@ class Y {
392
396
  },
393
397
  type: a.productType === "track" ? "TRACK" : "VIDEO"
394
398
  },
395
- streamingSessionId: this.#t
399
+ streamingSessionId: this.#e
396
400
  })
397
401
  ]
398
402
  }).catch(console.error);
399
403
  }
400
404
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
401
- reset(t) {
405
+ reset(e) {
402
406
  return Promise.resolve();
403
407
  }
404
408
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
405
- seek(t) {
409
+ seek(e) {
406
410
  }
407
411
  /**
408
412
  * Handle play log reporting for seeking.
409
413
  * Seek start should log a PLAYBACK_START action if playing post seek.
410
414
  */
411
- seekEnd() {
412
- this.currentStreamingSessionId && this.playbackState === "PLAYING" && c(this.currentStreamingSessionId, {
413
- actionType: "PLAYBACK_START",
414
- assetPosition: this.currentTime,
415
- timestamp: n.now()
416
- });
415
+ seekEnd(e) {
416
+ const t = this.currentStreamingSessionId;
417
+ if (t) {
418
+ const a = () => c(t, {
419
+ actionType: "PLAYBACK_START",
420
+ assetPosition: e,
421
+ timestamp: n.now()
422
+ });
423
+ if (this.playbackState === "PLAYING")
424
+ a().catch(console.error);
425
+ else {
426
+ const s = () => {
427
+ this.playbackState === "PLAYING" && (a().catch(console.error), o.removeEventListener(
428
+ "playback-state-change",
429
+ s
430
+ ));
431
+ };
432
+ o.addEventListener(
433
+ "playback-state-change",
434
+ s
435
+ );
436
+ }
437
+ }
417
438
  }
418
439
  /**
419
440
  * Handle play log reporting for seeking.
420
441
  * Seek start should log a PLAYBACK_STOP action.
421
442
  */
422
- seekStart() {
443
+ seekStart(e) {
423
444
  this.currentStreamingSessionId && c(this.currentStreamingSessionId, {
424
445
  actionType: "PLAYBACK_STOP",
425
- assetPosition: this.currentTime,
446
+ assetPosition: e,
426
447
  timestamp: n.now()
427
448
  });
428
449
  }
429
- async setStateToXIfNotYInZMs(t, e, a) {
430
- await f(t), this.playbackState !== e && (this.playbackState = a);
450
+ async setStateToXIfNotYInZMs(e, t, a) {
451
+ await f(e), this.playbackState !== t && (this.playbackState = a);
431
452
  }
432
453
  skipToPreloadedMediaProduct() {
433
454
  return Promise.resolve();
@@ -444,52 +465,52 @@ class Y {
444
465
  * enabled.
445
466
  */
446
467
  updateVolumeLevel() {
447
- const t = r.getStreamInfo(
468
+ const e = r.getStreamInfo(
448
469
  this.currentStreamingSessionId
449
470
  );
450
- t && (this.volume = this.adjustedVolume(t));
471
+ e && (this.volume = this.adjustedVolume(e));
451
472
  }
452
473
  /**
453
474
  * Adjusts the volume for the next track.
454
475
  * Can be called on product ended to have the level ready.
455
476
  */
456
477
  updateVolumeLevelForNextProduct() {
457
- const t = r.getStreamInfo(
478
+ const e = r.getStreamInfo(
458
479
  this.preloadedStreamingSessionId
459
480
  );
460
- t && (this.volume = this.adjustedVolume(t));
481
+ e && (this.volume = this.adjustedVolume(e));
461
482
  }
462
483
  get currentMediaProduct() {
463
484
  return r.getMediaProductTransition(
464
485
  this.currentStreamingSessionId
465
486
  )?.mediaProduct ?? null;
466
487
  }
467
- set currentStreamingSessionId(t) {
468
- this.#t = t;
488
+ set currentStreamingSessionId(e) {
489
+ this.#e = e;
469
490
  }
470
491
  get currentStreamingSessionId() {
471
- return this.#t;
492
+ return this.#e;
472
493
  }
473
- set currentTime(t) {
474
- this.#i = t, this.#c();
494
+ set currentTime(e) {
495
+ this.#i = e, this.#c();
475
496
  }
476
497
  get currentTime() {
477
498
  return this.#i;
478
499
  }
479
500
  get duration() {
480
- const t = r.getMediaProductTransition(
501
+ const e = r.getMediaProductTransition(
481
502
  this.currentStreamingSessionId
482
503
  );
483
- return t ? t.playbackContext.actualDuration : null;
504
+ return e ? e.playbackContext.actualDuration : null;
484
505
  }
485
506
  get expired() {
486
- const t = r.getStreamInfo(
507
+ const e = r.getStreamInfo(
487
508
  this.currentStreamingSessionId
488
509
  );
489
- return t ? t.expires <= Date.now() : !1;
510
+ return e ? e.expires <= Date.now() : !1;
490
511
  }
491
512
  get isActivePlayer() {
492
- return o.activePlayer && this.name === o.activePlayer.name;
513
+ return d.activePlayer && this.name === d.activePlayer.name;
493
514
  }
494
515
  get nextItem() {
495
516
  if (this.preloadedStreamingSessionId)
@@ -498,32 +519,21 @@ class Y {
498
519
  );
499
520
  }
500
521
  // eslint-disable-next-line accessor-pairs
501
- set outputDeviceType(t) {
502
- this.#n = t ? A(t) : void 0;
522
+ set outputDeviceType(e) {
523
+ this.#n = e ? A(e) : void 0;
503
524
  }
504
- set playbackState(t) {
505
- const e = this.#s;
506
- if (e === t || !this.currentStreamingSessionId)
525
+ set playbackState(e) {
526
+ const t = this.#s;
527
+ if (t === e || !this.currentStreamingSessionId)
507
528
  return;
508
- const a = (u, l) => e === u && l === t;
529
+ const a = (u, l) => t === u && l === e;
509
530
  switch (!0) {
510
531
  case a("NOT_PLAYING", "STALLED"):
511
532
  case a("IDLE", "STALLED"):
512
533
  return;
513
534
  case a("PLAYING", "NOT_PLAYING"):
514
535
  case a("PLAYING", "IDLE"): {
515
- this.reportPlaybackProgress(this.currentStreamingSessionId), console.debug(
516
- "PS",
517
- {
518
- from: e,
519
- to: t
520
- },
521
- {
522
- currentTime: this.#i,
523
- doIt: this.duration && this.currentTime < this.duration,
524
- duration: this.duration
525
- }
526
- ), this.duration && this.currentTime < this.duration && c(this.currentStreamingSessionId, {
536
+ this.reportPlaybackProgress(this.currentStreamingSessionId), this.duration && this.currentTime < this.duration && c(this.currentStreamingSessionId, {
527
537
  actionType: "PLAYBACK_STOP",
528
538
  assetPosition: this.currentTime,
529
539
  timestamp: n.now()
@@ -540,21 +550,21 @@ class Y {
540
550
  break;
541
551
  }
542
552
  }
543
- this.#s = t, this.debugLog(`playbackState: ${t}`);
544
- const i = o.activePlayer === void 0;
545
- (this.isActivePlayer || i) && d.dispatchEvent(E(this.#s));
553
+ this.#s = e, this.debugLog(`playbackState: ${e}`);
554
+ const s = d.activePlayer === void 0;
555
+ (this.isActivePlayer || s) && o.dispatchEvent(E(this.#s));
546
556
  }
547
557
  get playbackState() {
548
558
  return this.#s;
549
559
  }
550
560
  get prefetched() {
551
- const t = r.getStreamInfo(
561
+ const e = r.getStreamInfo(
552
562
  this.currentStreamingSessionId
553
563
  );
554
- return t && t.prefetched;
564
+ return e && e.prefetched;
555
565
  }
556
- set preloadedStreamingSessionId(t) {
557
- this.#o = t;
566
+ set preloadedStreamingSessionId(e) {
567
+ this.#o = e;
558
568
  }
559
569
  get preloadedStreamingSessionId() {
560
570
  return this.#o;
@@ -562,18 +572,18 @@ class Y {
562
572
  get startAssetPosition() {
563
573
  return this.#d;
564
574
  }
565
- set startAssetPosition(t) {
566
- this.#d = t;
575
+ set startAssetPosition(e) {
576
+ this.#d = e;
567
577
  }
568
578
  // eslint-disable-next-line @typescript-eslint/class-literal-property-style
569
579
  get volume() {
570
580
  return 1;
571
581
  }
572
- set volume(t) {
582
+ set volume(e) {
573
583
  }
574
584
  }
575
585
  export {
576
- G as O,
577
- N as V,
578
- Y
586
+ Y as G,
587
+ x as V,
588
+ G as Y
579
589
  };