@broadcastingplatforms/player 0.0.0-dev.0c8c26d

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.
@@ -0,0 +1,4 @@
1
+ export { BPLiveService, BPLiveError, type BPLiveResolvedResult } from './service';
2
+ export type { BPLiveConfig, BPLiveSource, BPLiveStreamSource, BPLiveClipSource, BPLiveStream, BPLiveStreamResponse, BPLiveClip, BPLiveClipResponse, BPLiveChannel, BPLiveActiveStream, BPLivePlayerSource, BPLiveLiveKitPlayerSource, BPLiveNanoPlayerSource, BPLiveClipMedia, } from './types';
3
+ export { isBPLiveSource, isBPLiveStreamSource, isBPLiveClipSource, } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,40 @@
1
+ import type { BPLiveConfig, BPLiveStreamResponse, BPLiveClipResponse, BPLiveSource, BPLiveStream, BPLiveClip } from './types';
2
+ import type { ResolvedPlayerSource } from '../providers/contract';
3
+ import type { ContentType } from '../core/state';
4
+ export interface BPLiveResolvedResult {
5
+ source: ResolvedPlayerSource;
6
+ contentType: ContentType;
7
+ poster?: string;
8
+ /** Video width from media metadata */
9
+ videoWidth?: number;
10
+ /** Video height from media metadata */
11
+ videoHeight?: number;
12
+ }
13
+ export declare class BPLiveError extends Error {
14
+ code: string;
15
+ status?: number | undefined;
16
+ constructor(message: string, code: string, status?: number | undefined);
17
+ }
18
+ export declare class BPLiveService {
19
+ private _config;
20
+ private _authToken;
21
+ private _stream;
22
+ private _clip;
23
+ constructor(config: BPLiveConfig);
24
+ get config(): BPLiveConfig;
25
+ get authToken(): string | null;
26
+ get stream(): BPLiveStream | null;
27
+ get clip(): BPLiveClip | null;
28
+ private fetch;
29
+ getStream(streamId: number): Promise<BPLiveStreamResponse>;
30
+ getClip(clipId: number): Promise<BPLiveClipResponse>;
31
+ private mapPlayerSourceToResolvedSource;
32
+ private selectClipMedia;
33
+ private mapClipMediaToPlayerSource;
34
+ resolveSource(source: BPLiveSource): Promise<BPLiveResolvedResult>;
35
+ private extractStreamPoster;
36
+ private resolveStreamSource;
37
+ private resolveClipSource;
38
+ destroy(): void;
39
+ }
40
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1,207 @@
1
+ export type BPLiveStreamSource = {
2
+ type: 'bplive';
3
+ streamId: number;
4
+ };
5
+ export type BPLiveClipSource = {
6
+ type: 'bplive';
7
+ clipId: number;
8
+ preferredOrientation?: 'landscape' | 'portrait';
9
+ };
10
+ export type BPLiveSource = BPLiveStreamSource | BPLiveClipSource;
11
+ export interface BPLiveConfig {
12
+ discoveryUrl: string;
13
+ authToken?: string;
14
+ }
15
+ export interface BPLiveChannel {
16
+ id: number;
17
+ slug: string;
18
+ user_login: string;
19
+ title: string;
20
+ description: string | null;
21
+ cover_image: string | null;
22
+ is_active: boolean;
23
+ follower_count: number;
24
+ is_following: boolean;
25
+ nick_name: string;
26
+ display_name: string;
27
+ bio: string;
28
+ avatar_url: string | null;
29
+ cover_photo_url: string | null;
30
+ status: string;
31
+ timezone: string;
32
+ links: Array<{
33
+ id: number;
34
+ provider: string | null;
35
+ url: string;
36
+ last_updated: string;
37
+ }>;
38
+ }
39
+ export interface BPLiveStreamTag {
40
+ id: number;
41
+ name: string;
42
+ }
43
+ export interface BPLiveVodMedia {
44
+ file_name: string;
45
+ mime_type: string | null;
46
+ original: string;
47
+ thumb: string | null;
48
+ collection_name: string | null;
49
+ duration: number;
50
+ created_at: string;
51
+ media_type: string;
52
+ dimension: {
53
+ width: number;
54
+ height: number;
55
+ };
56
+ }
57
+ export interface BPLiveStreamMedia {
58
+ vod: BPLiveVodMedia[];
59
+ clips: unknown[];
60
+ }
61
+ export interface BPLiveLiveKitPlayerSource {
62
+ provider: 'livekit';
63
+ url: string;
64
+ token: string;
65
+ room?: string;
66
+ }
67
+ export interface BPLiveNanoPlayerSource {
68
+ provider: 'nanoplayer';
69
+ id: string;
70
+ h5live: {
71
+ server: {
72
+ websocket: string;
73
+ hls: string;
74
+ };
75
+ rtmp: {
76
+ url: string;
77
+ streamname: string;
78
+ };
79
+ security: {
80
+ expires: string;
81
+ tag: string;
82
+ token: string;
83
+ options: string;
84
+ };
85
+ };
86
+ startIndex: number;
87
+ options: {
88
+ switch: {
89
+ method: string;
90
+ pauseOnError: boolean;
91
+ forcePlay: boolean;
92
+ fastStart: boolean;
93
+ timeout: number;
94
+ incTiming: boolean;
95
+ timestampReset: boolean;
96
+ };
97
+ adaption: {
98
+ rule: string;
99
+ };
100
+ };
101
+ entries: Array<{
102
+ index: number;
103
+ label: string;
104
+ tag: string;
105
+ info: {
106
+ bitrate: number;
107
+ width: number;
108
+ height: number;
109
+ framerate: number;
110
+ };
111
+ h5live: {
112
+ server: {
113
+ websocket: string;
114
+ hls: string;
115
+ };
116
+ rtmp: {
117
+ url: string;
118
+ streamname: string;
119
+ };
120
+ security: {
121
+ expires: string;
122
+ tag: string;
123
+ token: string;
124
+ options: string;
125
+ };
126
+ };
127
+ }>;
128
+ }
129
+ export type BPLivePlayerSource = BPLiveLiveKitPlayerSource | BPLiveNanoPlayerSource;
130
+ export interface BPLiveActiveStream {
131
+ id: number;
132
+ title: string;
133
+ viewer_count?: number;
134
+ started_at: string;
135
+ player_source: BPLivePlayerSource;
136
+ tags?: BPLiveStreamTag[];
137
+ description?: string;
138
+ }
139
+ export interface BPLiveStream {
140
+ id: number;
141
+ type: string;
142
+ title: string;
143
+ description: string | null;
144
+ stream_name: string;
145
+ started_at: string | null;
146
+ ended_at: string | null;
147
+ cover_photo: string | null;
148
+ tags: BPLiveStreamTag[];
149
+ channel: BPLiveChannel;
150
+ created_at: string;
151
+ created_at_formated: string;
152
+ updated_at: string;
153
+ scheduled_at: string | null;
154
+ is_expired: boolean;
155
+ is_locked: boolean;
156
+ media: BPLiveStreamMedia;
157
+ /** Player source returned directly from /streams/{id} endpoint */
158
+ player_source?: BPLivePlayerSource;
159
+ /** Active stream (used in channel endpoint responses) */
160
+ active_stream?: BPLiveActiveStream;
161
+ }
162
+ export interface BPLiveStreamResponse {
163
+ data: BPLiveStream;
164
+ }
165
+ export interface BPLiveClipMedia {
166
+ id: number;
167
+ url: string;
168
+ type: 'preview' | 'clip';
169
+ orientation: 'landscape' | 'portrait';
170
+ width: number;
171
+ height: number;
172
+ duration: number;
173
+ thumbnail: string | null;
174
+ created_at: string;
175
+ }
176
+ export interface BPLiveClipMetadata {
177
+ width: number;
178
+ height: number;
179
+ duration: number;
180
+ end_time: number;
181
+ start_time: number;
182
+ }
183
+ export interface BPLiveClip {
184
+ id: number;
185
+ title: string;
186
+ metadata: BPLiveClipMetadata;
187
+ context: Array<{
188
+ width: number;
189
+ height: number;
190
+ duration: number;
191
+ thumb_id: number;
192
+ }>;
193
+ status: string;
194
+ media: BPLiveClipMedia[];
195
+ nick_name: string;
196
+ privacy: string;
197
+ created_at: string;
198
+ playlists: unknown[];
199
+ channel: BPLiveChannel;
200
+ }
201
+ export interface BPLiveClipResponse {
202
+ data: BPLiveClip;
203
+ }
204
+ export declare function isBPLiveStreamSource(source: unknown): source is BPLiveStreamSource;
205
+ export declare function isBPLiveClipSource(source: unknown): source is BPLiveClipSource;
206
+ export declare function isBPLiveSource(source: unknown): source is BPLiveSource;
207
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import type { PlayerCore } from '../core/player-core';
3
+ import type { ProviderConfig, SourceDescription } from '../providers/contract';
4
+ import 'media-chrome';
5
+ import 'media-chrome/menu';
6
+ import './bp-player';
7
+ import './bp-error-display';
8
+ import type { BPLiveService } from '../bplive/service';
9
+ export type BPDefaultUIReadyEvent = CustomEvent<PlayerCore>;
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'bp-default-ui': BPDefaultUI;
13
+ }
14
+ interface HTMLElementEventMap {
15
+ ready: BPDefaultUIReadyEvent;
16
+ }
17
+ }
18
+ /**
19
+ * Complete player UI with controls, loading states, and error handling.
20
+ * Uses light DOM for NanoPlayer compatibility.
21
+ */
22
+ export declare class BPDefaultUI extends LitElement {
23
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
24
+ connectedCallback(): void;
25
+ disconnectedCallback(): void;
26
+ source?: SourceDescription;
27
+ autoplay: boolean;
28
+ muted: boolean;
29
+ loop: boolean;
30
+ poster?: string;
31
+ scaling: 'letterbox' | 'crop' | 'fill';
32
+ aspectRatio?: string;
33
+ config?: ProviderConfig;
34
+ debug: boolean;
35
+ autohide: number;
36
+ hotkeys: boolean;
37
+ mobile: boolean;
38
+ live: boolean;
39
+ /** When set, automatically adjusts aspect ratio to match the video content */
40
+ fluid: boolean;
41
+ private _player;
42
+ private _providerType;
43
+ private _error;
44
+ private _connectionState;
45
+ private _showEndedOverlay;
46
+ private _cleanupListeners;
47
+ get player(): PlayerCore | null;
48
+ get mediaController(): HTMLElement | null;
49
+ get bpLive(): BPLiveService | null;
50
+ private detectMobile;
51
+ private _getPoster;
52
+ protected firstUpdated(_changedProperties: PropertyValues): void;
53
+ protected updated(_changedProperties: PropertyValues): void;
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
+ private _moveSlottedContent;
61
+ private setupPlayer;
62
+ private setupPlayerListeners;
63
+ private renderDefaultControls;
64
+ protected render(): import("lit").TemplateResult<1>;
65
+ }
66
+ //# sourceMappingURL=bp-default-ui.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { LitElement } from 'lit';
2
+ import type { PlayerError } from '../core/state';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'bp-error-display': BPErrorDisplay;
6
+ }
7
+ }
8
+ /**
9
+ * `<bp-error-display>` - Displays error information with icon, heading, and message.
10
+ *
11
+ * @slot icon - Custom icon to display
12
+ * @slot heading - Custom heading text (for i18n)
13
+ * @slot message - Custom message (overrides error.message)
14
+ * @slot code - Custom error code display
15
+ * @slot actions - Action buttons (e.g., fullscreen button, retry button)
16
+ *
17
+ * @csspart icon - The icon container
18
+ * @csspart heading - The heading element
19
+ * @csspart message - The message element
20
+ * @csspart code - The error code element
21
+ * @csspart actions - The actions container
22
+ */
23
+ export declare class BPErrorDisplay extends LitElement {
24
+ static styles: import("lit").CSSResult;
25
+ error: PlayerError | null;
26
+ showCode: boolean;
27
+ render(): import("lit").TemplateResult<1> | null;
28
+ private renderIcon;
29
+ }
30
+ //# sourceMappingURL=bp-error-display.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { LitElement } from 'lit';
2
+ export type OverlayType = 'loading' | 'offline' | 'ended' | 'none';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'bp-overlay': BPOverlay;
6
+ }
7
+ }
8
+ /**
9
+ * `<bp-overlay>` - Displays overlay states like loading, offline, or ended.
10
+ *
11
+ * @slot icon - Custom icon to display
12
+ * @slot message - Custom message text (for i18n)
13
+ * @slot submessage - Custom submessage text
14
+ *
15
+ * @csspart icon - The icon container
16
+ * @csspart message - The message element
17
+ * @csspart submessage - The submessage element
18
+ */
19
+ export declare class BPOverlay extends LitElement {
20
+ static styles: import("lit").CSSResult;
21
+ type: OverlayType;
22
+ live: boolean;
23
+ buttonMode: boolean;
24
+ private getIcon;
25
+ private getDefaultMessage;
26
+ render(): import("lit").TemplateResult<1> | null;
27
+ private renderIcon;
28
+ }
29
+ //# sourceMappingURL=bp-overlay.d.ts.map
@@ -0,0 +1,86 @@
1
+ import { LitElement, type PropertyValues } from 'lit';
2
+ import { type PlayerCore } from '../core/player-core';
3
+ import type { PlayerState } from '../core/state';
4
+ import type { ProviderType, ProviderConfig, SourceDescription } from '../providers/contract';
5
+ import type { BPLiveService } from '../bplive/service';
6
+ import { VideoRenditionList } from './video-rendition-list';
7
+ export type BPPlayerReadyEvent = CustomEvent<PlayerCore>;
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'bp-player': BPPlayer;
11
+ }
12
+ interface HTMLElementEventMap {
13
+ 'ready': BPPlayerReadyEvent;
14
+ }
15
+ }
16
+ export declare class BPPlayer extends LitElement {
17
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
18
+ connectedCallback(): void;
19
+ source?: SourceDescription;
20
+ autoplay: boolean;
21
+ defaultMuted: boolean;
22
+ loop: boolean;
23
+ scaling: 'letterbox' | 'crop' | 'fill';
24
+ aspectRatio?: string;
25
+ config?: ProviderConfig;
26
+ debug: boolean;
27
+ private _playerCore;
28
+ private containerRef;
29
+ private providerContainer;
30
+ private eventCleanup;
31
+ private stateReceivers;
32
+ private _mutationObserver;
33
+ private _videoRenditions;
34
+ private _hasDispatchedReady;
35
+ get player(): PlayerCore | null;
36
+ get playerState(): PlayerState | null;
37
+ get bpLive(): BPLiveService | null;
38
+ play(): Promise<void>;
39
+ pause(): void;
40
+ get paused(): boolean;
41
+ get ended(): boolean;
42
+ get seeking(): boolean;
43
+ get waiting(): boolean;
44
+ get currentTime(): number;
45
+ set currentTime(value: number);
46
+ get duration(): number;
47
+ get volume(): number;
48
+ set volume(value: number);
49
+ get muted(): boolean;
50
+ set muted(value: boolean);
51
+ get playbackRate(): number;
52
+ set playbackRate(value: number);
53
+ get readyState(): number;
54
+ get buffered(): TimeRanges;
55
+ get videoWidth(): number;
56
+ get videoHeight(): number;
57
+ get videoElement(): HTMLVideoElement | null;
58
+ get providerType(): ProviderType | null;
59
+ get videoRenditions(): VideoRenditionList | null;
60
+ disconnectedCallback(): void;
61
+ protected firstUpdated(_changedProperties: PropertyValues): void;
62
+ protected updated(changedProperties: PropertyValues): void;
63
+ /**
64
+ * Initialize player core once. Called in firstUpdated.
65
+ */
66
+ private initPlayerCore;
67
+ /**
68
+ * Load source into player core. Player core handles provider switching internally.
69
+ */
70
+ private loadSource;
71
+ private handleMutation;
72
+ private registerStateReceiver;
73
+ private unregisterStateReceiver;
74
+ private propagateStateToAllReceivers;
75
+ private setupEventForwarding;
76
+ private updateStateAttributes;
77
+ private destroyPlayer;
78
+ /** Update video dimension CSS variables */
79
+ updateVideoDimensions(width: number, height: number): void;
80
+ /** Clear video dimension CSS variables */
81
+ private clearVideoDimensions;
82
+ private getContainerClasses;
83
+ private getContainerStyle;
84
+ protected render(): import("lit").TemplateResult<1>;
85
+ }
86
+ //# sourceMappingURL=bp-player.d.ts.map
@@ -0,0 +1,6 @@
1
+ export { BPPlayer, type BPPlayerReadyEvent } from './bp-player';
2
+ export { BPDefaultUI, type BPDefaultUIReadyEvent } from './bp-default-ui';
3
+ export { BPErrorDisplay } from './bp-error-display';
4
+ export { BPOverlay, type OverlayType } from './bp-overlay';
5
+ export { VideoRenditionList, type VideoRendition, type VideoRenditionHost } from './video-rendition-list';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,38 @@
1
+ import type { PlayerCore } from '../core/player-core';
2
+ /**
3
+ * Represents a single video rendition/quality level.
4
+ * Compatible with media-chrome's VideoRendition interface.
5
+ */
6
+ export interface VideoRendition {
7
+ id: string;
8
+ width: number;
9
+ height: number;
10
+ bitrate: number;
11
+ selected: boolean;
12
+ }
13
+ /**
14
+ * Interface for the player host that provides access to PlayerCore.
15
+ */
16
+ export interface VideoRenditionHost {
17
+ readonly player: PlayerCore | null;
18
+ }
19
+ /**
20
+ * VideoRenditionList provides media-chrome compatibility for quality selection.
21
+ * It exposes video quality levels as an iterable list with selection support.
22
+ */
23
+ export declare class VideoRenditionList extends EventTarget {
24
+ [index: number]: VideoRendition;
25
+ private _host;
26
+ private _renditions;
27
+ private _cleanup;
28
+ constructor(host: VideoRenditionHost);
29
+ get length(): number;
30
+ [Symbol.iterator](): Iterator<VideoRendition>;
31
+ get selectedIndex(): number;
32
+ set selectedIndex(index: number);
33
+ private _updateSelection;
34
+ _syncFromPlayer(): void;
35
+ _setupListeners(): void;
36
+ _destroy(): void;
37
+ }
38
+ //# sourceMappingURL=video-rendition-list.d.ts.map
@@ -0,0 +1,7 @@
1
+ export { createPlayerCore, PlayerCoreImpl } from './player-core';
2
+ export type { PlayerCore, PlayerCoreEventMap, PlayerCoreEventType, SourceLoadResult } from './player-core';
3
+ export { createInitialState, classifyNanoPlayerError, classifyLiveKitError, NANOPLAYER_NO_REPLAY_CODES } from './state';
4
+ export type { PlayerState, QualityLevel, PresentationMode, ConnectionState, StreamType, ProviderType, PlayerError, ErrorCategory, } from './state';
5
+ export { StateReceiverMixin, StateReceiverProps, isStateReceiverElement, forEachStateReceiverElement, propagateStateToReceiver, removeStateFromReceiver, } from './state-receiver';
6
+ export type { StateReceiverElement, StateReceiverPropertyMap } from './state-receiver';
7
+ //# sourceMappingURL=index.d.ts.map