eb-player 2.0.1 → 2.0.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.
Files changed (35) hide show
  1. package/dist/build/eb-player.css +661 -5
  2. package/dist/build/ebplayer.bundle.js +62 -23
  3. package/dist/build/ebplayer.bundle.js.map +1 -1
  4. package/dist/build/theme-forja.css +1 -1
  5. package/dist/build/theme-lequipe.css +655 -0
  6. package/dist/build/theme-modern.css +1 -1
  7. package/dist/build/theme-v2.css +1 -1
  8. package/dist/build/types/core/config.d.ts +14 -2
  9. package/dist/build/types/core/config.d.ts.map +1 -1
  10. package/dist/build/types/core/index.d.ts +1 -1
  11. package/dist/build/types/core/index.d.ts.map +1 -1
  12. package/dist/build/types/core/lifecycle.d.ts.map +1 -1
  13. package/dist/build/types/engines/hls.d.ts +1 -0
  14. package/dist/build/types/engines/hls.d.ts.map +1 -1
  15. package/dist/build/types/engines/snapshot/hls.d.ts +1 -1
  16. package/dist/build/types/engines/snapshot/hls.d.ts.map +1 -1
  17. package/dist/build/types/integrations/p2p-manager.d.ts.map +1 -1
  18. package/dist/dev/default.js +734 -508
  19. package/dist/dev/default.js.map +1 -1
  20. package/dist/dev/easybroadcast.js +89 -47
  21. package/dist/dev/easybroadcast.js.map +1 -1
  22. package/dist/dev/equipe.js +6683 -0
  23. package/dist/dev/equipe.js.map +1 -0
  24. package/dist/eb-player.css +661 -5
  25. package/dist/players/easybroadcast/easybroadcast.js +397 -0
  26. package/dist/players/easybroadcast/index.html +1 -0
  27. package/dist/players/equipe/equipe.js +397 -0
  28. package/dist/players/equipe/index.html +1 -0
  29. package/dist/players/forja/forja.js +198 -111
  30. package/dist/players/forja/index.html +1 -1
  31. package/dist/theme-forja.css +1 -1
  32. package/dist/theme-lequipe.css +655 -0
  33. package/dist/theme-modern.css +1 -1
  34. package/dist/theme-v2.css +1 -1
  35. package/package.json +8 -73
@@ -274,28 +274,45 @@
274
274
  right: ['forward']
275
275
  }
276
276
  };
277
+ /**
278
+ * Available themes — single source of truth for all theme names and labels.
279
+ * The test player reads this to populate the skin selector dynamically.
280
+ * Add new entries here when creating a new theme-*.css file.
281
+ */
282
+ const AVAILABLE_THEMES = [
283
+ { value: 'default', label: 'Default' },
284
+ { value: 'forja', label: 'Forja', primaryColor: '#FC013B' },
285
+ { value: 'radio', label: 'Radio', primaryColor: '#F4A261' },
286
+ { value: 'snrt', label: 'SNRT', primaryColor: '#006633' },
287
+ { value: 'modern', label: 'Modern', primaryColor: '#7c3aed' },
288
+ { value: 'v2', label: 'V2', primaryColor: '#ff841f' },
289
+ { value: 'lequipe', label: "L'Equipe", primaryColor: '#d61e00' },
290
+ ];
277
291
  /**
278
292
  * Theme-specific default layouts.
279
293
  * Used when config.layout is not explicitly provided but a theme is set.
280
294
  */
281
- const THEME_LAYOUTS = {
282
- v2: {
283
- topBar: {
284
- left: [],
285
- right: ['settings', 'pip', 'cast']
286
- },
287
- bottomBar: {
288
- left: ['play-pause', 'live-sync', 'time'],
289
- center: ['seekbar'],
290
- right: ['volume', 'fullscreen']
291
- },
292
- middleBar: {
293
- left: ['rewind'],
294
- center: [],
295
- right: ['forward']
296
- }
295
+ const V2_LAYOUT = {
296
+ topBar: {
297
+ left: [],
298
+ right: ['settings', 'pip', 'cast']
299
+ },
300
+ bottomBar: {
301
+ left: ['play-pause', 'live-sync', 'time'],
302
+ center: ['seekbar'],
303
+ right: ['volume', 'fullscreen']
304
+ },
305
+ middleBar: {
306
+ left: ['rewind'],
307
+ center: [],
308
+ right: ['forward']
297
309
  }
298
310
  };
311
+ const THEME_LAYOUTS = {
312
+ v2: V2_LAYOUT,
313
+ lequipe: V2_LAYOUT,
314
+ modern: V2_LAYOUT,
315
+ };
299
316
  /**
300
317
  * Returns the effective layout for a given config.
301
318
  * Priority: explicit config.layout > theme default > DEFAULT_LAYOUT
@@ -3642,6 +3659,13 @@
3642
3659
  */
3643
3660
  mount(container) {
3644
3661
  this._container = container;
3662
+ // Clear container DOM so a fresh <video> element is created on each mount.
3663
+ // This prevents EME/MediaKeys conflicts — setMediaKeys(null) is async and
3664
+ // hls.js destroy() doesn't wait for it, so reusing the same <video> element
3665
+ // causes "The existing ContentDecryptor" errors on skin switch.
3666
+ container.textContent = '';
3667
+ // Clear lit-html's internal render state so render() treats the container as fresh
3668
+ delete container['_$litPart$'];
3645
3669
  // Clear any stale theme/style from a previous mount cycle
3646
3670
  container.removeAttribute('data-theme');
3647
3671
  container.removeAttribute('style');
@@ -4857,6 +4881,7 @@
4857
4881
  // Private — NEVER in PlayerState (Pitfall 2)
4858
4882
  this.driver = null;
4859
4883
  this.tokenManager = null;
4884
+ this.autoQuality = true;
4860
4885
  // Holds state reference for named driver event handlers
4861
4886
  this.eventState = null;
4862
4887
  this.liveSyncDisabled = false;
@@ -4916,6 +4941,14 @@
4916
4941
  if (this.driver === null)
4917
4942
  return;
4918
4943
  this.driver.currentLevel = index;
4944
+ // When index is -1 (Auto/ABR), hls.js will fire LEVEL_SWITCHED with the
4945
+ // actual resolved level. We need to keep currentQuality as -1 so the UI
4946
+ // shows "Auto" as selected. Track ABR mode to prevent LEVEL_SWITCHED
4947
+ // from overwriting it.
4948
+ this.autoQuality = index === -1;
4949
+ if (this.state !== null) {
4950
+ this.state.currentQuality = index;
4951
+ }
4919
4952
  }
4920
4953
  setAudioTrack(index) {
4921
4954
  if (this.driver === null)
@@ -4977,7 +5010,7 @@
4977
5010
  token: config.token,
4978
5011
  tokenType: config.tokenType,
4979
5012
  srcInTokenRequest: config.srcInTokenRequest,
4980
- extraParamsCallback: config.extraParamsCallback,
5013
+ extraParamsCallback: (config.engineSettings.extraParamsCallback ?? config.extraParamsCallback),
4981
5014
  onCDNTokenError: config.engineSettings.onCDNTokenError
4982
5015
  });
4983
5016
  // Fetch initial token
@@ -4988,7 +5021,7 @@
4988
5021
  if (this.detached)
4989
5022
  return;
4990
5023
  }
4991
- console.info('HlsEngine: loading hls.js from', hlsjsUrl);
5024
+ // console.info('HlsEngine: loading hls.js from', hlsjsUrl)
4992
5025
  const Hls = await loadScript(hlsjsUrl, 'Hls');
4993
5026
  // Guard: abort if detached during CDN script load
4994
5027
  if (this.detached)
@@ -5145,8 +5178,12 @@
5145
5178
  const state = this.eventState;
5146
5179
  if (!state)
5147
5180
  return;
5148
- const switchedData = data;
5149
- state.currentQuality = switchedData.level;
5181
+ // In ABR mode (autoQuality), keep currentQuality as -1 so the UI shows "Auto".
5182
+ // Only update to the actual level index when the user picked a specific quality.
5183
+ if (!this.autoQuality) {
5184
+ const switchedData = data;
5185
+ state.currentQuality = switchedData.level;
5186
+ }
5150
5187
  }
5151
5188
  _onAudioTracksUpdated(_event, data) {
5152
5189
  const state = this.eventState;
@@ -5525,7 +5562,7 @@
5525
5562
  };
5526
5563
  // Register with AbortSignal so it auto-removes when engine is detached
5527
5564
  window.addEventListener('unhandledrejection', this.dvrErrorHandler, { signal });
5528
- console.info('DashEngine: loading dashjs from', dashjsUrl);
5565
+ // console.info('DashEngine: loading dashjs from', dashjsUrl)
5529
5566
  const dashjs = await loadScript(dashjsUrl, 'dashjs');
5530
5567
  const player = dashjs.MediaPlayer().create();
5531
5568
  if (!player) {
@@ -5691,7 +5728,9 @@
5691
5728
  this.lib.start();
5692
5729
  // Clean up on abort
5693
5730
  signal.addEventListener('abort', () => {
5694
- this.lib.stop();
5731
+ if (this.lib !== null && typeof this.lib.stop === 'function') {
5732
+ this.lib.stop();
5733
+ }
5695
5734
  this.lib = null;
5696
5735
  }, { once: true });
5697
5736
  }
@@ -6190,7 +6229,7 @@
6190
6229
  // window.EBPlayer assignment
6191
6230
  // ---------------------------------------------------------------------------
6192
6231
  if (typeof window !== 'undefined') {
6193
- window.EBPlayer = { start, stop, destroy };
6232
+ window.EBPlayer = { start, stop, destroy, AVAILABLE_THEMES, THEME_LAYOUTS };
6194
6233
  }
6195
6234
 
6196
6235
  /**