@broadcastingplatforms/player 0.0.0-dev.3802fed → 0.0.0-dev.6988ade

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 (40) hide show
  1. package/README.md +157 -0
  2. package/dist/bp-player.js +397 -307
  3. package/dist/bp-player.mjs +397 -307
  4. package/dist/bp-player.standalone.mjs +412 -322
  5. package/dist/bplive/service.d.ts +4 -2
  6. package/dist/components/bp-default-ui.d.ts +10 -10
  7. package/dist/components/bp-error-display.d.ts +2 -0
  8. package/dist/components/bp-player.d.ts +7 -9
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/player-core.d.ts +4 -2
  11. package/dist/core/state.d.ts +1 -0
  12. package/dist/index.d.ts +2 -2
  13. package/dist/providers/contract.d.ts +9 -0
  14. package/dist/util/attribute.d.ts +0 -3
  15. package/package.json +7 -4
  16. package/dist/bp-player.js.map +0 -7
  17. package/dist/bp-player.mjs.map +0 -7
  18. package/dist/bp-player.standalone.mjs.map +0 -7
  19. package/dist/bplive/index.d.ts.map +0 -1
  20. package/dist/bplive/service.d.ts.map +0 -1
  21. package/dist/bplive/types.d.ts.map +0 -1
  22. package/dist/components/bp-default-ui.d.ts.map +0 -1
  23. package/dist/components/bp-error-display.d.ts.map +0 -1
  24. package/dist/components/bp-overlay.d.ts.map +0 -1
  25. package/dist/components/bp-player.d.ts.map +0 -1
  26. package/dist/components/index.d.ts.map +0 -1
  27. package/dist/core/index.d.ts.map +0 -1
  28. package/dist/core/player-core.d.ts.map +0 -1
  29. package/dist/core/state-receiver.d.ts.map +0 -1
  30. package/dist/core/state.d.ts.map +0 -1
  31. package/dist/elements/hls-video.d.ts.map +0 -1
  32. package/dist/elements/index.d.ts.map +0 -1
  33. package/dist/elements/livekit-video.d.ts.map +0 -1
  34. package/dist/elements/nano-video.d.ts.map +0 -1
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/providers/contract.d.ts.map +0 -1
  37. package/dist/providers/index.d.ts.map +0 -1
  38. package/dist/styles/index.d.ts.map +0 -1
  39. package/dist/util/attribute.d.ts.map +0 -1
  40. package/dist/util/index.d.ts.map +0 -1
@@ -5,8 +5,10 @@ export interface BPLiveResolvedResult {
5
5
  source: ResolvedPlayerSource;
6
6
  contentType: ContentType;
7
7
  poster?: string;
8
- /** Aspect ratio based on orientation (portrait: 9/16, landscape: 16/9) */
9
- aspectRatio?: string;
8
+ /** Video width from media metadata */
9
+ videoWidth?: number;
10
+ /** Video height from media metadata */
11
+ videoHeight?: number;
10
12
  }
11
13
  export declare class BPLiveError extends Error {
12
14
  code: string;
@@ -1,11 +1,10 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
2
  import type { PlayerCore } from '../core/player-core';
3
- import type { ProviderConfig, PlayerSources } from '../providers/contract';
3
+ import type { ProviderConfig, SourceDescription } from '../providers/contract';
4
4
  import 'media-chrome';
5
5
  import 'media-chrome/menu';
6
6
  import './bp-player';
7
7
  import './bp-error-display';
8
- import './bp-overlay';
9
8
  import type { BPLiveService } from '../bplive/service';
10
9
  export type BPDefaultUIReadyEvent = CustomEvent<PlayerCore>;
11
10
  declare global {
@@ -24,7 +23,7 @@ export declare class BPDefaultUI extends LitElement {
24
23
  protected createRenderRoot(): HTMLElement | DocumentFragment;
25
24
  connectedCallback(): void;
26
25
  disconnectedCallback(): void;
27
- sources?: PlayerSources;
26
+ source?: SourceDescription;
28
27
  autoplay: boolean;
29
28
  muted: boolean;
30
29
  loop: boolean;
@@ -42,21 +41,22 @@ export declare class BPDefaultUI extends LitElement {
42
41
  private _player;
43
42
  private _providerType;
44
43
  private _error;
45
- private _overlayType;
46
44
  private _connectionState;
47
- private _hasError;
48
- private _hasCustomTopChrome;
49
- private _hasCustomCenteredChrome;
50
- private _hasCustomBottomChrome;
45
+ private _showEndedOverlay;
51
46
  private _cleanupListeners;
52
47
  get player(): PlayerCore | null;
53
48
  get mediaController(): HTMLElement | null;
54
49
  get bpLive(): BPLiveService | null;
55
- private _detectCustomChrome;
56
50
  private detectMobile;
51
+ private _getPoster;
57
52
  protected firstUpdated(_changedProperties: PropertyValues): void;
58
53
  protected updated(_changedProperties: PropertyValues): void;
59
- private _setInitialAspectRatioFromSources;
54
+ /** Set initial video dimensions from preferredOrientation hint */
55
+ private _setInitialVideoDimensionsFromSources;
56
+ /** Update video dimension CSS variables */
57
+ private _updateVideoDimensions;
58
+ /** Clear video dimension CSS variables */
59
+ private _clearVideoDimensions;
60
60
  private _moveSlottedContent;
61
61
  private setupPlayer;
62
62
  private setupPlayerListeners;
@@ -12,11 +12,13 @@ declare global {
12
12
  * @slot heading - Custom heading text (for i18n)
13
13
  * @slot message - Custom message (overrides error.message)
14
14
  * @slot code - Custom error code display
15
+ * @slot actions - Action buttons (e.g., fullscreen button, retry button)
15
16
  *
16
17
  * @csspart icon - The icon container
17
18
  * @csspart heading - The heading element
18
19
  * @csspart message - The message element
19
20
  * @csspart code - The error code element
21
+ * @csspart actions - The actions container
20
22
  */
21
23
  export declare class BPErrorDisplay extends LitElement {
22
24
  static styles: import("lit").CSSResult;
@@ -1,7 +1,7 @@
1
1
  import { LitElement, type PropertyValues } from 'lit';
2
2
  import { type PlayerCore } from '../core/player-core';
3
3
  import type { PlayerState } from '../core/state';
4
- import type { ProviderType, ProviderConfig, PlayerSources } from '../providers/contract';
4
+ import type { ProviderType, ProviderConfig, SourceDescription } from '../providers/contract';
5
5
  import type { BPLiveService } from '../bplive/service';
6
6
  export type BPPlayerReadyEvent = CustomEvent<PlayerCore>;
7
7
  declare global {
@@ -37,18 +37,16 @@ declare class VideoRenditionList extends EventTarget {
37
37
  export declare class BPPlayer extends LitElement {
38
38
  protected createRenderRoot(): HTMLElement | DocumentFragment;
39
39
  connectedCallback(): void;
40
- sources?: PlayerSources;
40
+ source?: SourceDescription;
41
41
  autoplay: boolean;
42
42
  defaultMuted: boolean;
43
43
  loop: boolean;
44
- poster?: string;
45
44
  scaling: 'letterbox' | 'crop' | 'fill';
46
45
  aspectRatio?: string;
47
46
  config?: ProviderConfig;
48
47
  debug: boolean;
49
48
  private _playerCore;
50
49
  private _ready;
51
- private _resolvedPoster;
52
50
  private containerRef;
53
51
  private providerContainer;
54
52
  private eventCleanup;
@@ -83,7 +81,7 @@ export declare class BPPlayer extends LitElement {
83
81
  disconnectedCallback(): void;
84
82
  protected firstUpdated(_changedProperties: PropertyValues): void;
85
83
  protected updated(changedProperties: PropertyValues): void;
86
- private resolveSourcesArray;
84
+ private getPlayableSource;
87
85
  private handleMutation;
88
86
  private registerStateReceiver;
89
87
  private unregisterStateReceiver;
@@ -93,12 +91,12 @@ export declare class BPPlayer extends LitElement {
93
91
  private initPlayer;
94
92
  private loadPlayableSource;
95
93
  private destroyPlayer;
96
- /** Set --bp-aspect-ratio CSS variable if not already defined by consumer */
97
- private setAspectRatioVariable;
94
+ /** Update video dimension CSS variables */
95
+ updateVideoDimensions(width: number, height: number): void;
96
+ /** Clear video dimension CSS variables */
97
+ private clearVideoDimensions;
98
98
  private getContainerClasses;
99
- private getPosterClasses;
100
99
  private getContainerStyle;
101
- private getEffectivePoster;
102
100
  protected render(): import("lit").TemplateResult<1>;
103
101
  }
104
102
  export {};
@@ -1,6 +1,6 @@
1
1
  export { createPlayerCore, PlayerCoreImpl } from './player-core';
2
2
  export type { PlayerCore, PlayerCoreEventMap, PlayerCoreEventType } from './player-core';
3
- export { createInitialState, classifyNanoPlayerError, NANOPLAYER_NO_REPLAY_CODES } from './state';
3
+ export { createInitialState, classifyNanoPlayerError, classifyLiveKitError, NANOPLAYER_NO_REPLAY_CODES } from './state';
4
4
  export type { PlayerState, QualityLevel, PresentationMode, ConnectionState, StreamType, ProviderType, PlayerError, ErrorCategory, } from './state';
5
5
  export { StateReceiverMixin, StateReceiverProps, isStateReceiverElement, forEachStateReceiverElement, propagateStateToReceiver, removeStateFromReceiver, } from './state-receiver';
6
6
  export type { StateReceiverElement, StateReceiverPropertyMap } from './state-receiver';
@@ -94,7 +94,8 @@ export interface PlayerCore {
94
94
  removeEventListener<K extends PlayerCoreEventType>(type: K | K[], listener: EventListener<PlayerCoreEventMap[K]>): void;
95
95
  loadSource(source: string | PlayerSource, container: HTMLElement, config?: ProviderConfig): Promise<{
96
96
  poster?: string;
97
- aspectRatio?: string;
97
+ videoWidth?: number;
98
+ videoHeight?: number;
98
99
  } | void>;
99
100
  unloadSource(): void;
100
101
  play(): Promise<void>;
@@ -128,7 +129,8 @@ export declare class PlayerCoreImpl implements PlayerCore {
128
129
  private updateState;
129
130
  loadSource(source: string | PlayerSource, container: HTMLElement, config?: ProviderConfig): Promise<{
130
131
  poster?: string;
131
- aspectRatio?: string;
132
+ videoWidth?: number;
133
+ videoHeight?: number;
132
134
  } | void>;
133
135
  private createMediaElement;
134
136
  private attachMediaElementListeners;
@@ -47,5 +47,6 @@ export interface PlayerError {
47
47
  }
48
48
  export declare const NANOPLAYER_NO_REPLAY_CODES: readonly [1005, 1007, 1008, 1009, 3001, 3002, 3003, 3004, 3005, 3100, 3101, 3200, 4003];
49
49
  export declare function classifyNanoPlayerError(code: number): ErrorCategory;
50
+ export declare function classifyLiveKitError(code: number): ErrorCategory;
50
51
  export declare function createInitialState(): PlayerState;
51
52
  //# sourceMappingURL=state.d.ts.map
package/dist/index.d.ts CHANGED
@@ -7,11 +7,11 @@ export { Attribute, toggleAttribute } from './util/attribute';
7
7
  export { HlsVideoElement, HlsVideo, Hls, NanoVideoElement, NanoVideo, LiveKitVideoElement, LiveKitVideo, } from './elements/index';
8
8
  export { createPlayerCore, PlayerCoreImpl } from './core/player-core';
9
9
  export type { PlayerCore, PlayerCoreEventMap, PlayerCoreEventType, CustomVideoElement } from './core/player-core';
10
- export { createInitialState, classifyNanoPlayerError, NANOPLAYER_NO_REPLAY_CODES } from './core/state';
10
+ export { createInitialState, classifyNanoPlayerError, classifyLiveKitError, NANOPLAYER_NO_REPLAY_CODES } from './core/state';
11
11
  export type { PlayerState, QualityLevel, PresentationMode, ConnectionState, StreamType, ContentType, PlayerError, ErrorCategory, } from './core/state';
12
12
  export { StateReceiverMixin, StateReceiverProps, isStateReceiverElement, forEachStateReceiverElement, propagateStateToReceiver, removeStateFromReceiver, } from './core/state-receiver';
13
13
  export type { StateReceiverElement, StateReceiverPropertyMap } from './core/state-receiver';
14
- export type { ProviderType, ProviderConfig, VideoProviderConfig, NanoProviderConfig, LiveKitProviderConfig, PlayerSource, ResolvedPlayerSource, VideoSource, NanoSource, LiveKitSource, PosterSource, PlayerSourceItem, PlayerSources, } from './providers/contract';
14
+ export type { ProviderType, ProviderConfig, VideoProviderConfig, NanoProviderConfig, LiveKitProviderConfig, PlayerSource, ResolvedPlayerSource, VideoSource, NanoSource, LiveKitSource, PosterSource, PlayerSourceItem, PlayerSources, SourceDescription, } from './providers/contract';
15
15
  export { BPLiveService, BPLiveError, type BPLiveResolvedResult } from './bplive/service';
16
16
  export { isBPLiveSource, isBPLiveStreamSource, isBPLiveClipSource, } from './bplive/types';
17
17
  export type { BPLiveConfig, BPLiveSource, BPLiveStreamSource, BPLiveClipSource, BPLiveStream, BPLiveStreamResponse, BPLiveClip, BPLiveClipResponse, BPLiveChannel, BPLiveActiveStream, BPLivePlayerSource, BPLiveLiveKitPlayerSource, BPLiveNanoPlayerSource, BPLiveClipMedia, } from './bplive/types';
@@ -51,6 +51,15 @@ export type PosterSource = {
51
51
  };
52
52
  export type PlayerSourceItem = PlayerSource | PosterSource;
53
53
  export type PlayerSources = PlayerSourceItem[];
54
+ /**
55
+ * Source description containing sources and optional metadata.
56
+ */
57
+ export interface SourceDescription {
58
+ /** Array of playable sources */
59
+ sources: PlayerSource[];
60
+ /** Poster image URL */
61
+ poster?: string;
62
+ }
54
63
  export interface ProviderConfig {
55
64
  libraryLocation?: string;
56
65
  video?: VideoProviderConfig;
@@ -1,7 +1,5 @@
1
1
  /**
2
2
  * Centralized HTML attributes used by BP Player components.
3
- *
4
- * Following theoplayer's pattern for consistent attribute naming.
5
3
  */
6
4
  export declare enum Attribute {
7
5
  CONFIGURATION = "configuration",
@@ -10,7 +8,6 @@ export declare enum Attribute {
10
8
  AUTOPLAY = "autoplay",
11
9
  MUTED = "muted",
12
10
  LOOP = "loop",
13
- POSTER = "poster",
14
11
  SCALING = "scaling",
15
12
  ASPECT_RATIO = "aspect-ratio",
16
13
  DEBUG = "debug",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@broadcastingplatforms/player",
3
- "version": "0.0.0-dev.3802fed",
3
+ "version": "0.0.0-dev.6988ade",
4
4
  "description": "Universal video player web component built with Lit",
5
5
  "type": "module",
6
6
  "main": "dist/bp-player.js",
@@ -36,7 +36,8 @@
36
36
  "./package.json": "./package.json"
37
37
  },
38
38
  "files": [
39
- "dist/"
39
+ "dist/",
40
+ "!**/*.map"
40
41
  ],
41
42
  "dependencies": {
42
43
  "better-call": "^1.0.6",
@@ -49,9 +50,11 @@
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/node": "^22.10.2",
53
+ "concurrently": "^9.1.2",
52
54
  "esbuild": "^0.24.0",
53
55
  "typescript": "^5.7.2",
54
- "vite": "^6.0.5"
56
+ "vite": "^6.0.5",
57
+ "@broadcastingplatforms/web-connectors": "0.0.0-dev.6988ade"
55
58
  },
56
59
  "license": "UNLICENSED",
57
60
  "publishConfig": {
@@ -62,7 +65,7 @@
62
65
  "build:types": "tsc --emitDeclarationOnly",
63
66
  "build:bundle": "node build.mjs",
64
67
  "build:prod": "NODE_ENV=production pnpm build",
65
- "dev": "node build.mjs --watch",
68
+ "dev": "concurrently \"tsc --emitDeclarationOnly --watch --preserveWatchOutput\" \"node build.mjs --watch\"",
66
69
  "dev:demo": "vite"
67
70
  }
68
71
  }