@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.
- package/README.md +157 -0
- package/dist/bp-player.js +2986 -0
- package/dist/bp-player.mjs +2985 -0
- package/dist/bp-player.standalone.mjs +3047 -0
- package/dist/bplive/index.d.ts +4 -0
- package/dist/bplive/service.d.ts +40 -0
- package/dist/bplive/types.d.ts +207 -0
- package/dist/components/bp-default-ui.d.ts +66 -0
- package/dist/components/bp-error-display.d.ts +30 -0
- package/dist/components/bp-overlay.d.ts +29 -0
- package/dist/components/bp-player.d.ts +86 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/video-rendition-list.d.ts +38 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/player-core.d.ts +182 -0
- package/dist/core/state-receiver.d.ts +37 -0
- package/dist/core/state.d.ts +52 -0
- package/dist/elements/hls-video.d.ts +27 -0
- package/dist/elements/index.d.ts +4 -0
- package/dist/elements/livekit-video.d.ts +51 -0
- package/dist/elements/nano-video.d.ts +142 -0
- package/dist/index.d.ts +18 -0
- package/dist/providers/contract.d.ts +111 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/styles/index.d.ts +23 -0
- package/dist/util/attribute.d.ts +59 -0
- package/dist/util/index.d.ts +2 -0
- package/package.json +71 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { PlayerState, QualityLevel, PresentationMode, ConnectionState, StreamType, PlayerError } from './state';
|
|
2
|
+
import type { ProviderType, PlayerSource, ProviderConfig } from '../providers/contract';
|
|
3
|
+
import { BPLiveService } from '../bplive/service';
|
|
4
|
+
export interface PlayerCoreEventMap {
|
|
5
|
+
play: void;
|
|
6
|
+
playing: void;
|
|
7
|
+
pause: void;
|
|
8
|
+
ended: void;
|
|
9
|
+
waiting: void;
|
|
10
|
+
seeking: {
|
|
11
|
+
currentTime: number;
|
|
12
|
+
};
|
|
13
|
+
seeked: {
|
|
14
|
+
currentTime: number;
|
|
15
|
+
};
|
|
16
|
+
timeupdate: {
|
|
17
|
+
currentTime: number;
|
|
18
|
+
duration: number;
|
|
19
|
+
};
|
|
20
|
+
emptied: void;
|
|
21
|
+
loadstart: void;
|
|
22
|
+
loadedmetadata: {
|
|
23
|
+
duration: number;
|
|
24
|
+
videoWidth: number;
|
|
25
|
+
videoHeight: number;
|
|
26
|
+
};
|
|
27
|
+
loadeddata: void;
|
|
28
|
+
canplay: void;
|
|
29
|
+
canplaythrough: void;
|
|
30
|
+
durationchange: {
|
|
31
|
+
duration: number;
|
|
32
|
+
};
|
|
33
|
+
progress: {
|
|
34
|
+
buffered: TimeRanges;
|
|
35
|
+
};
|
|
36
|
+
resize: {
|
|
37
|
+
videoWidth: number;
|
|
38
|
+
videoHeight: number;
|
|
39
|
+
};
|
|
40
|
+
volumechange: {
|
|
41
|
+
volume: number;
|
|
42
|
+
muted: boolean;
|
|
43
|
+
};
|
|
44
|
+
ratechange: {
|
|
45
|
+
playbackRate: number;
|
|
46
|
+
};
|
|
47
|
+
qualitieschange: {
|
|
48
|
+
qualities: QualityLevel[];
|
|
49
|
+
};
|
|
50
|
+
qualitychange: {
|
|
51
|
+
quality: QualityLevel;
|
|
52
|
+
auto: boolean;
|
|
53
|
+
};
|
|
54
|
+
targetqualitychanged: {
|
|
55
|
+
quality: QualityLevel | null;
|
|
56
|
+
};
|
|
57
|
+
sourcechange: {
|
|
58
|
+
source: string | PlayerSource | null;
|
|
59
|
+
};
|
|
60
|
+
fullscreenchange: {
|
|
61
|
+
fullscreen: boolean;
|
|
62
|
+
};
|
|
63
|
+
presentationmodechange: {
|
|
64
|
+
mode: PresentationMode;
|
|
65
|
+
};
|
|
66
|
+
connectionstatechange: {
|
|
67
|
+
state: ConnectionState;
|
|
68
|
+
};
|
|
69
|
+
streamtypechange: {
|
|
70
|
+
streamType: StreamType;
|
|
71
|
+
};
|
|
72
|
+
videoelementchange: {
|
|
73
|
+
video: HTMLVideoElement | null;
|
|
74
|
+
};
|
|
75
|
+
error: PlayerError;
|
|
76
|
+
destroy: void;
|
|
77
|
+
statechange: {
|
|
78
|
+
state: PlayerState;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export type PlayerCoreEventType = keyof PlayerCoreEventMap;
|
|
82
|
+
type EventListener<T> = (event: T) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Custom video element interface - all video elements (HlsVideoElement, NanoVideoElement, etc.)
|
|
85
|
+
* extend CustomVideoElement from custom-media-element and expose nativeEl
|
|
86
|
+
*/
|
|
87
|
+
export type CustomVideoElement = HTMLVideoElement & {
|
|
88
|
+
nativeEl: HTMLVideoElement;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Result returned when a source is loaded, containing metadata from the source.
|
|
92
|
+
*/
|
|
93
|
+
export interface SourceLoadResult {
|
|
94
|
+
poster?: string;
|
|
95
|
+
videoWidth?: number;
|
|
96
|
+
videoHeight?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface PlayerCore {
|
|
99
|
+
readonly state: PlayerState;
|
|
100
|
+
readonly videoElement: HTMLVideoElement | null;
|
|
101
|
+
readonly bpLive: BPLiveService | null;
|
|
102
|
+
/** Whether the player is ready (attached and can accept sources) */
|
|
103
|
+
readonly ready: boolean;
|
|
104
|
+
/** Current provider type based on loaded source */
|
|
105
|
+
readonly providerType: ProviderType | null;
|
|
106
|
+
addEventListener<K extends PlayerCoreEventType>(type: K | K[], listener: EventListener<PlayerCoreEventMap[K]>): void;
|
|
107
|
+
removeEventListener<K extends PlayerCoreEventType>(type: K | K[], listener: EventListener<PlayerCoreEventMap[K]>): void;
|
|
108
|
+
/**
|
|
109
|
+
* Attach the player to a container element. Call once during initialization.
|
|
110
|
+
* After attaching, you can set sources via the source property or loadSource().
|
|
111
|
+
*/
|
|
112
|
+
attach(container: HTMLElement, config?: ProviderConfig): void;
|
|
113
|
+
/**
|
|
114
|
+
* Load a source. Handles provider switching automatically.
|
|
115
|
+
* If source type changes (e.g., video -> nano), the player will
|
|
116
|
+
* destroy the old element and create a new one.
|
|
117
|
+
*/
|
|
118
|
+
loadSource(source: string | PlayerSource, container?: HTMLElement, config?: ProviderConfig): Promise<SourceLoadResult | void>;
|
|
119
|
+
unloadSource(): void;
|
|
120
|
+
play(): Promise<void>;
|
|
121
|
+
pause(): void;
|
|
122
|
+
seek(time: number): void;
|
|
123
|
+
setVolume(volume: number): void;
|
|
124
|
+
setMuted(muted: boolean): void;
|
|
125
|
+
setLoop(loop: boolean): void;
|
|
126
|
+
setPlaybackRate(rate: number): void;
|
|
127
|
+
setTargetQuality(quality: QualityLevel | null): void;
|
|
128
|
+
setQuality(quality: QualityLevel | null): void;
|
|
129
|
+
setFullscreen(fullscreen: boolean): void;
|
|
130
|
+
setPresentationMode(mode: PresentationMode): void;
|
|
131
|
+
destroy(): void;
|
|
132
|
+
}
|
|
133
|
+
export declare class PlayerCoreImpl implements PlayerCore {
|
|
134
|
+
private _state;
|
|
135
|
+
private _mediaElement;
|
|
136
|
+
private _container;
|
|
137
|
+
private _config;
|
|
138
|
+
private _listeners;
|
|
139
|
+
private _eventCleanup;
|
|
140
|
+
private _destroyed;
|
|
141
|
+
private _bpLive;
|
|
142
|
+
private _currentProviderType;
|
|
143
|
+
private _ready;
|
|
144
|
+
constructor();
|
|
145
|
+
get state(): PlayerState;
|
|
146
|
+
get videoElement(): HTMLVideoElement | null;
|
|
147
|
+
get bpLive(): BPLiveService | null;
|
|
148
|
+
get ready(): boolean;
|
|
149
|
+
get providerType(): ProviderType | null;
|
|
150
|
+
addEventListener<K extends PlayerCoreEventType>(type: K | K[], listener: EventListener<PlayerCoreEventMap[K]>): void;
|
|
151
|
+
removeEventListener<K extends PlayerCoreEventType>(type: K | K[], listener: EventListener<PlayerCoreEventMap[K]>): void;
|
|
152
|
+
private dispatch;
|
|
153
|
+
private updateState;
|
|
154
|
+
/**
|
|
155
|
+
* Attach the player to a container. Call once during initialization.
|
|
156
|
+
*/
|
|
157
|
+
attach(container: HTMLElement, config?: ProviderConfig): void;
|
|
158
|
+
loadSource(source: string | PlayerSource, container?: HTMLElement, config?: ProviderConfig): Promise<SourceLoadResult | void>;
|
|
159
|
+
/**
|
|
160
|
+
* Destroy the current media element and clean up listeners.
|
|
161
|
+
*/
|
|
162
|
+
private destroyMediaElement;
|
|
163
|
+
private createMediaElement;
|
|
164
|
+
private attachMediaElementListeners;
|
|
165
|
+
private handleMediaEvent;
|
|
166
|
+
unloadSource(): void;
|
|
167
|
+
play(): Promise<void>;
|
|
168
|
+
pause(): void;
|
|
169
|
+
seek(time: number): void;
|
|
170
|
+
setVolume(volume: number): void;
|
|
171
|
+
setMuted(muted: boolean): void;
|
|
172
|
+
setLoop(loop: boolean): void;
|
|
173
|
+
setPlaybackRate(rate: number): void;
|
|
174
|
+
setTargetQuality(quality: QualityLevel | null): void;
|
|
175
|
+
setQuality(quality: QualityLevel | null): void;
|
|
176
|
+
setFullscreen(fullscreen: boolean): void;
|
|
177
|
+
setPresentationMode(mode: PresentationMode): void;
|
|
178
|
+
destroy(): void;
|
|
179
|
+
}
|
|
180
|
+
export declare function createPlayerCore(): PlayerCore;
|
|
181
|
+
export {};
|
|
182
|
+
//# sourceMappingURL=player-core.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PlayerState, QualityLevel, StreamType, PresentationMode, ConnectionState, PlayerError } from './state';
|
|
2
|
+
import type { PlayerCore } from './player-core';
|
|
3
|
+
export declare const StateReceiverProps: "bpPlayerObservedProperties";
|
|
4
|
+
export interface StateReceiverPropertyMap {
|
|
5
|
+
player: PlayerCore | undefined;
|
|
6
|
+
paused: boolean;
|
|
7
|
+
playing: boolean;
|
|
8
|
+
ended: boolean;
|
|
9
|
+
seeking: boolean;
|
|
10
|
+
currentTime: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
volume: number;
|
|
13
|
+
muted: boolean;
|
|
14
|
+
playbackRate: number;
|
|
15
|
+
readyState: number;
|
|
16
|
+
videoWidth: number;
|
|
17
|
+
videoHeight: number;
|
|
18
|
+
qualities: QualityLevel[];
|
|
19
|
+
currentQuality: QualityLevel | null;
|
|
20
|
+
targetQuality: QualityLevel | null;
|
|
21
|
+
fullscreen: boolean;
|
|
22
|
+
presentationMode: PresentationMode;
|
|
23
|
+
connectionState: ConnectionState;
|
|
24
|
+
streamType: StreamType;
|
|
25
|
+
error: PlayerError | null;
|
|
26
|
+
}
|
|
27
|
+
export interface StateReceiverElement extends Partial<StateReceiverPropertyMap>, Element {
|
|
28
|
+
readonly [StateReceiverProps]: Array<keyof StateReceiverPropertyMap>;
|
|
29
|
+
}
|
|
30
|
+
export declare function isStateReceiverElement(element: Element): element is StateReceiverElement;
|
|
31
|
+
type Constructor<T> = abstract new (...args: any[]) => T;
|
|
32
|
+
export declare function StateReceiverMixin<T extends Constructor<Element>>(base: T, props: Array<keyof StateReceiverPropertyMap>): T & Constructor<StateReceiverElement>;
|
|
33
|
+
export declare function forEachStateReceiverElement(element: Element, excludeElement: HTMLElement | null, callback: (receiver: StateReceiverElement) => void): Promise<void>;
|
|
34
|
+
export declare function propagateStateToReceiver(receiver: StateReceiverElement, player: PlayerCore | undefined, state: PlayerState): void;
|
|
35
|
+
export declare function removeStateFromReceiver(receiver: StateReceiverElement): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=state-receiver.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface PlayerState {
|
|
2
|
+
readonly paused: boolean;
|
|
3
|
+
readonly playing: boolean;
|
|
4
|
+
readonly ended: boolean;
|
|
5
|
+
readonly seeking: boolean;
|
|
6
|
+
readonly waiting: boolean;
|
|
7
|
+
readonly currentTime: number;
|
|
8
|
+
readonly duration: number;
|
|
9
|
+
readonly buffered: TimeRanges | null;
|
|
10
|
+
readonly volume: number;
|
|
11
|
+
readonly muted: boolean;
|
|
12
|
+
readonly loop: boolean;
|
|
13
|
+
readonly playbackRate: number;
|
|
14
|
+
readonly readyState: 0 | 1 | 2 | 3 | 4;
|
|
15
|
+
readonly videoWidth: number;
|
|
16
|
+
readonly videoHeight: number;
|
|
17
|
+
readonly qualities: QualityLevel[];
|
|
18
|
+
readonly currentQuality: QualityLevel | null;
|
|
19
|
+
readonly targetQuality: QualityLevel | null;
|
|
20
|
+
readonly fullscreen: boolean;
|
|
21
|
+
readonly presentationMode: PresentationMode;
|
|
22
|
+
readonly providerType: ProviderType | null;
|
|
23
|
+
readonly connectionState: ConnectionState;
|
|
24
|
+
readonly streamType: StreamType;
|
|
25
|
+
readonly contentType: ContentType;
|
|
26
|
+
readonly error: PlayerError | null;
|
|
27
|
+
}
|
|
28
|
+
export interface QualityLevel {
|
|
29
|
+
index: number;
|
|
30
|
+
height: number;
|
|
31
|
+
width: number;
|
|
32
|
+
bitrate: number;
|
|
33
|
+
codec?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
}
|
|
36
|
+
export type PresentationMode = 'inline' | 'fullscreen' | 'pip';
|
|
37
|
+
export type ConnectionState = 'idle' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'failed';
|
|
38
|
+
export type StreamType = 'vod' | 'live' | 'dvr';
|
|
39
|
+
export type ProviderType = 'video' | 'nano' | 'livekit';
|
|
40
|
+
export type ContentType = 'clip' | 'stream' | 'video';
|
|
41
|
+
export type ErrorCategory = 'offline' | 'network' | 'security' | 'media' | 'autoplay' | 'setup' | 'unknown';
|
|
42
|
+
export interface PlayerError {
|
|
43
|
+
code: number;
|
|
44
|
+
message: string;
|
|
45
|
+
fatal: boolean;
|
|
46
|
+
category: ErrorCategory;
|
|
47
|
+
}
|
|
48
|
+
export declare const NANOPLAYER_NO_REPLAY_CODES: readonly [1005, 1007, 1008, 1009, 3001, 3002, 3003, 3004, 3005, 3100, 3101, 3200, 4003];
|
|
49
|
+
export declare function classifyNanoPlayerError(code: number): ErrorCategory;
|
|
50
|
+
export declare function classifyLiveKitError(code: number): ErrorCategory;
|
|
51
|
+
export declare function createInitialState(): PlayerState;
|
|
52
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomVideoElement } from 'custom-media-element';
|
|
2
|
+
import Hls from 'hls.js';
|
|
3
|
+
type HlsVideoConfig = Partial<Hls['config']>;
|
|
4
|
+
declare const MediaTracksVideoElement: import("media-tracks").WithMediaTracks<CustomVideoElement>;
|
|
5
|
+
declare class HlsVideoElement extends MediaTracksVideoElement {
|
|
6
|
+
#private;
|
|
7
|
+
static shadowRootOptions: {
|
|
8
|
+
clonable?: boolean;
|
|
9
|
+
customElementRegistry?: CustomElementRegistry;
|
|
10
|
+
delegatesFocus?: boolean;
|
|
11
|
+
mode: ShadowRootMode;
|
|
12
|
+
serializable?: boolean;
|
|
13
|
+
slotAssignment?: SlotAssignmentMode;
|
|
14
|
+
};
|
|
15
|
+
static getTemplateHTML(attrs: Record<string, string>, props?: {
|
|
16
|
+
config?: HlsVideoConfig;
|
|
17
|
+
}): string;
|
|
18
|
+
api: Hls | null;
|
|
19
|
+
constructor();
|
|
20
|
+
get config(): HlsVideoConfig | null;
|
|
21
|
+
set config(value: HlsVideoConfig | null);
|
|
22
|
+
attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null): void;
|
|
23
|
+
load(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export default HlsVideoElement;
|
|
26
|
+
export { Hls, HlsVideoElement };
|
|
27
|
+
//# sourceMappingURL=hls-video.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as HlsVideoElement, Hls, HlsVideoElement as HlsVideo } from './hls-video';
|
|
2
|
+
export { default as NanoVideoElement, NanoVideoElement as NanoVideo } from './nano-video';
|
|
3
|
+
export { default as LiveKitVideoElement, LiveKitVideoElement as LiveKitVideo } from './livekit-video';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CustomVideoElement } from 'custom-media-element';
|
|
2
|
+
import { Room } from 'livekit-client';
|
|
3
|
+
interface LiveKitVideoConfig {
|
|
4
|
+
peerConnectionTimeout?: number;
|
|
5
|
+
iceTransportPolicy?: 'all' | 'relay';
|
|
6
|
+
adaptiveStream?: boolean;
|
|
7
|
+
dynacast?: boolean;
|
|
8
|
+
disconnectOnPageLeave?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const MediaTracksVideoElement: import("media-tracks").WithMediaTracks<CustomVideoElement>;
|
|
11
|
+
declare class LiveKitVideoElement extends MediaTracksVideoElement {
|
|
12
|
+
#private;
|
|
13
|
+
static get observedAttributes(): string[];
|
|
14
|
+
static shadowRootOptions: {
|
|
15
|
+
clonable?: boolean;
|
|
16
|
+
customElementRegistry?: CustomElementRegistry;
|
|
17
|
+
delegatesFocus?: boolean;
|
|
18
|
+
mode: ShadowRootMode;
|
|
19
|
+
serializable?: boolean;
|
|
20
|
+
slotAssignment?: SlotAssignmentMode;
|
|
21
|
+
};
|
|
22
|
+
static getTemplateHTML(attrs: Record<string, string>, props?: {
|
|
23
|
+
config?: LiveKitVideoConfig;
|
|
24
|
+
}): string;
|
|
25
|
+
room: Room | null;
|
|
26
|
+
constructor();
|
|
27
|
+
get config(): LiveKitVideoConfig | null;
|
|
28
|
+
set config(value: LiveKitVideoConfig | null);
|
|
29
|
+
get url(): string | null;
|
|
30
|
+
set url(value: string | null);
|
|
31
|
+
get token(): string | null;
|
|
32
|
+
set token(value: string | null);
|
|
33
|
+
attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null): void;
|
|
34
|
+
load(): Promise<void>;
|
|
35
|
+
play(): Promise<void>;
|
|
36
|
+
pause(): void;
|
|
37
|
+
get currentTime(): number;
|
|
38
|
+
set currentTime(value: number);
|
|
39
|
+
get duration(): number;
|
|
40
|
+
get paused(): boolean;
|
|
41
|
+
get volume(): number;
|
|
42
|
+
set volume(value: number);
|
|
43
|
+
get muted(): boolean;
|
|
44
|
+
set muted(value: boolean);
|
|
45
|
+
get videoWidth(): number;
|
|
46
|
+
get videoHeight(): number;
|
|
47
|
+
disconnectedCallback(): void;
|
|
48
|
+
}
|
|
49
|
+
export default LiveKitVideoElement;
|
|
50
|
+
export { LiveKitVideoElement };
|
|
51
|
+
//# sourceMappingURL=livekit-video.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { CustomVideoElement } from 'custom-media-element';
|
|
2
|
+
interface NanoPlayerInstance {
|
|
3
|
+
setup: (config: NanoPlayerConfig) => Promise<NanoSetupResult>;
|
|
4
|
+
destroy: () => void;
|
|
5
|
+
play: () => void;
|
|
6
|
+
pause: () => void;
|
|
7
|
+
mute: () => void;
|
|
8
|
+
unmute: () => void;
|
|
9
|
+
setAdaption: (options: {
|
|
10
|
+
rule: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
switchStream: (index: number) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
interface NanoSetupResult {
|
|
15
|
+
source: {
|
|
16
|
+
entries?: Array<{
|
|
17
|
+
info: {
|
|
18
|
+
height: number;
|
|
19
|
+
width: number;
|
|
20
|
+
bitrate: number;
|
|
21
|
+
framerate: number;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface NanoPlayerEvent<T = unknown> {
|
|
27
|
+
name: string;
|
|
28
|
+
player: string;
|
|
29
|
+
id: string;
|
|
30
|
+
version: string;
|
|
31
|
+
data: T;
|
|
32
|
+
state: number;
|
|
33
|
+
}
|
|
34
|
+
interface NanoPlayerConfig {
|
|
35
|
+
source: unknown;
|
|
36
|
+
playback: {
|
|
37
|
+
autoplay: boolean;
|
|
38
|
+
muted: boolean;
|
|
39
|
+
reconnect?: {
|
|
40
|
+
minDelay: number;
|
|
41
|
+
maxDelay: number;
|
|
42
|
+
delaySteps: number;
|
|
43
|
+
maxRetries: number;
|
|
44
|
+
};
|
|
45
|
+
buffer?: {
|
|
46
|
+
min: number;
|
|
47
|
+
max: number;
|
|
48
|
+
target: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
style: {
|
|
52
|
+
width: string | number;
|
|
53
|
+
height: string | number;
|
|
54
|
+
controls: boolean;
|
|
55
|
+
view?: boolean;
|
|
56
|
+
interactive?: boolean;
|
|
57
|
+
};
|
|
58
|
+
events: {
|
|
59
|
+
onReady?: (event: NanoPlayerEvent) => void;
|
|
60
|
+
onPlay?: (event: NanoPlayerEvent) => void;
|
|
61
|
+
onPause?: (event: NanoPlayerEvent<{
|
|
62
|
+
reason: string;
|
|
63
|
+
}>) => void;
|
|
64
|
+
onLoading?: (event: NanoPlayerEvent) => void;
|
|
65
|
+
onStartBuffering?: (event: NanoPlayerEvent) => void;
|
|
66
|
+
onStopBuffering?: (event: NanoPlayerEvent) => void;
|
|
67
|
+
onError?: (event: NanoPlayerEvent<{
|
|
68
|
+
code: number;
|
|
69
|
+
message?: string;
|
|
70
|
+
}>) => void;
|
|
71
|
+
onSwitchStreamSuccess?: (event: NanoPlayerEvent<{
|
|
72
|
+
id: string;
|
|
73
|
+
index: number;
|
|
74
|
+
}>) => void;
|
|
75
|
+
onSwitchStreamFail?: (event: NanoPlayerEvent<{
|
|
76
|
+
id: string;
|
|
77
|
+
index: number;
|
|
78
|
+
}>) => void;
|
|
79
|
+
onActiveVideoElementChange?: (event: NanoPlayerEvent<{
|
|
80
|
+
activeVideoElement: HTMLVideoElement;
|
|
81
|
+
videoElementList: HTMLVideoElement[];
|
|
82
|
+
}>) => void;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
interface NanoVideoConfig {
|
|
86
|
+
reconnect?: {
|
|
87
|
+
minDelay: number;
|
|
88
|
+
maxDelay: number;
|
|
89
|
+
delaySteps: number;
|
|
90
|
+
maxRetries: number;
|
|
91
|
+
};
|
|
92
|
+
buffer?: {
|
|
93
|
+
min: number;
|
|
94
|
+
max: number;
|
|
95
|
+
target: number;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
declare const MediaTracksVideoElement: import("media-tracks").WithMediaTracks<CustomVideoElement>;
|
|
99
|
+
declare class NanoVideoElement extends MediaTracksVideoElement {
|
|
100
|
+
#private;
|
|
101
|
+
static get observedAttributes(): string[];
|
|
102
|
+
static shadowRootOptions: {
|
|
103
|
+
clonable?: boolean;
|
|
104
|
+
customElementRegistry?: CustomElementRegistry;
|
|
105
|
+
delegatesFocus?: boolean;
|
|
106
|
+
mode: ShadowRootMode;
|
|
107
|
+
serializable?: boolean;
|
|
108
|
+
slotAssignment?: SlotAssignmentMode;
|
|
109
|
+
};
|
|
110
|
+
static getTemplateHTML(attrs: Record<string, string>, props?: {
|
|
111
|
+
config?: NanoVideoConfig;
|
|
112
|
+
}): string;
|
|
113
|
+
api: NanoPlayerInstance | null;
|
|
114
|
+
constructor();
|
|
115
|
+
get config(): NanoVideoConfig | null;
|
|
116
|
+
set config(value: NanoVideoConfig | null);
|
|
117
|
+
/** Full NanoPlayer source configuration from API */
|
|
118
|
+
get sourceConfig(): unknown | null;
|
|
119
|
+
set sourceConfig(value: unknown | null);
|
|
120
|
+
get streamid(): string | null;
|
|
121
|
+
set streamid(value: string | null);
|
|
122
|
+
get libraryLocation(): string;
|
|
123
|
+
set libraryLocation(value: string);
|
|
124
|
+
attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null): void;
|
|
125
|
+
load(): Promise<void>;
|
|
126
|
+
play(): Promise<void>;
|
|
127
|
+
pause(): void;
|
|
128
|
+
get currentTime(): number;
|
|
129
|
+
set currentTime(value: number);
|
|
130
|
+
get duration(): number;
|
|
131
|
+
get paused(): boolean;
|
|
132
|
+
get volume(): number;
|
|
133
|
+
set volume(value: number);
|
|
134
|
+
get muted(): boolean;
|
|
135
|
+
set muted(value: boolean);
|
|
136
|
+
get videoWidth(): number;
|
|
137
|
+
get videoHeight(): number;
|
|
138
|
+
disconnectedCallback(): void;
|
|
139
|
+
}
|
|
140
|
+
export default NanoVideoElement;
|
|
141
|
+
export { NanoVideoElement };
|
|
142
|
+
//# sourceMappingURL=nano-video.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { BPPlayer, type BPPlayerReadyEvent } from './components/bp-player';
|
|
2
|
+
export { BPDefaultUI, type BPDefaultUIReadyEvent } from './components/bp-default-ui';
|
|
3
|
+
export { BPErrorDisplay } from './components/bp-error-display';
|
|
4
|
+
export { BPOverlay, type OverlayType } from './components/bp-overlay';
|
|
5
|
+
export { addGlobalStyles, createTemplate, templateWithStyles } from './styles/index';
|
|
6
|
+
export { Attribute, toggleAttribute } from './util/attribute';
|
|
7
|
+
export { HlsVideoElement, HlsVideo, Hls, NanoVideoElement, NanoVideo, LiveKitVideoElement, LiveKitVideo, } from './elements/index';
|
|
8
|
+
export { createPlayerCore, PlayerCoreImpl } from './core/player-core';
|
|
9
|
+
export type { PlayerCore, PlayerCoreEventMap, PlayerCoreEventType, CustomVideoElement } from './core/player-core';
|
|
10
|
+
export { createInitialState, classifyNanoPlayerError, classifyLiveKitError, NANOPLAYER_NO_REPLAY_CODES } from './core/state';
|
|
11
|
+
export type { PlayerState, QualityLevel, PresentationMode, ConnectionState, StreamType, ContentType, PlayerError, ErrorCategory, } from './core/state';
|
|
12
|
+
export { StateReceiverMixin, StateReceiverProps, isStateReceiverElement, forEachStateReceiverElement, propagateStateToReceiver, removeStateFromReceiver, } from './core/state-receiver';
|
|
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, SourceDescription, } from './providers/contract';
|
|
15
|
+
export { BPLiveService, BPLiveError, type BPLiveResolvedResult } from './bplive/service';
|
|
16
|
+
export { isBPLiveSource, isBPLiveStreamSource, isBPLiveClipSource, } from './bplive/types';
|
|
17
|
+
export type { BPLiveConfig, BPLiveSource, BPLiveStreamSource, BPLiveClipSource, BPLiveStream, BPLiveStreamResponse, BPLiveClip, BPLiveClipResponse, BPLiveChannel, BPLiveActiveStream, BPLivePlayerSource, BPLiveLiveKitPlayerSource, BPLiveNanoPlayerSource, BPLiveClipMedia, } from './bplive/types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { BPLiveSource, BPLiveConfig } from '../bplive/types';
|
|
2
|
+
export type ProviderType = 'video' | 'nano' | 'livekit';
|
|
3
|
+
export type VideoSource = {
|
|
4
|
+
type: 'video';
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
export type NanoSource = {
|
|
8
|
+
type: 'nano';
|
|
9
|
+
/** Bintu group ID for simple config */
|
|
10
|
+
streamid?: string;
|
|
11
|
+
/** Full NanoPlayer source config from API */
|
|
12
|
+
source?: NanoPlayerSourceConfig;
|
|
13
|
+
};
|
|
14
|
+
/** NanoPlayer source configuration from API */
|
|
15
|
+
export interface NanoPlayerSourceConfig {
|
|
16
|
+
h5live?: unknown;
|
|
17
|
+
startIndex?: number;
|
|
18
|
+
options?: {
|
|
19
|
+
switch?: {
|
|
20
|
+
method?: string;
|
|
21
|
+
pauseOnError?: boolean;
|
|
22
|
+
forcePlay?: boolean;
|
|
23
|
+
fastStart?: boolean;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
};
|
|
26
|
+
adaption?: {
|
|
27
|
+
rule?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
entries?: Array<{
|
|
31
|
+
h5live?: unknown;
|
|
32
|
+
info?: {
|
|
33
|
+
height?: number;
|
|
34
|
+
width?: number;
|
|
35
|
+
bitrate?: number;
|
|
36
|
+
framerate?: number;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export type LiveKitSource = {
|
|
41
|
+
type: 'livekit';
|
|
42
|
+
url: string;
|
|
43
|
+
token: string;
|
|
44
|
+
room?: string;
|
|
45
|
+
};
|
|
46
|
+
export type ResolvedPlayerSource = VideoSource | NanoSource | LiveKitSource;
|
|
47
|
+
export type PlayerSource = ResolvedPlayerSource | BPLiveSource;
|
|
48
|
+
export type PosterSource = {
|
|
49
|
+
type: 'poster';
|
|
50
|
+
url: string;
|
|
51
|
+
};
|
|
52
|
+
export type PlayerSourceItem = PlayerSource | PosterSource;
|
|
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
|
+
}
|
|
63
|
+
export interface ProviderConfig {
|
|
64
|
+
libraryLocation?: string;
|
|
65
|
+
video?: VideoProviderConfig;
|
|
66
|
+
nano?: NanoProviderConfig;
|
|
67
|
+
livekit?: LiveKitProviderConfig;
|
|
68
|
+
bpLive?: BPLiveConfig;
|
|
69
|
+
}
|
|
70
|
+
export interface VideoProviderConfig {
|
|
71
|
+
enableWorker?: boolean;
|
|
72
|
+
lowLatencyMode?: boolean;
|
|
73
|
+
backBufferLength?: number;
|
|
74
|
+
maxBufferLength?: number;
|
|
75
|
+
maxMaxBufferLength?: number;
|
|
76
|
+
fragLoadingTimeOut?: number;
|
|
77
|
+
manifestLoadingTimeOut?: number;
|
|
78
|
+
levelLoadingTimeOut?: number;
|
|
79
|
+
abrEwmaDefaultEstimate?: number;
|
|
80
|
+
startLevel?: number;
|
|
81
|
+
capLevelToPlayerSize?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface NanoProviderConfig {
|
|
84
|
+
reconnect?: {
|
|
85
|
+
minDelay: number;
|
|
86
|
+
maxDelay: number;
|
|
87
|
+
delaySteps: number;
|
|
88
|
+
maxRetries: number;
|
|
89
|
+
};
|
|
90
|
+
buffer?: {
|
|
91
|
+
min: number;
|
|
92
|
+
max: number;
|
|
93
|
+
target: number;
|
|
94
|
+
};
|
|
95
|
+
timeouts?: {
|
|
96
|
+
loading: number;
|
|
97
|
+
buffering: number;
|
|
98
|
+
connecting: number;
|
|
99
|
+
};
|
|
100
|
+
adaption?: {
|
|
101
|
+
rule: string;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export interface LiveKitProviderConfig {
|
|
105
|
+
peerConnectionTimeout?: number;
|
|
106
|
+
iceTransportPolicy?: 'all' | 'relay';
|
|
107
|
+
adaptiveStream?: boolean;
|
|
108
|
+
dynacast?: boolean;
|
|
109
|
+
disconnectOnPageLeave?: boolean;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { ProviderType, ProviderConfig, VideoProviderConfig, NanoProviderConfig, LiveKitProviderConfig, PlayerSource, ResolvedPlayerSource, VideoSource, NanoSource, LiveKitSource, PosterSource, PlayerSourceItem, PlayerSources, } from './contract';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BP Player Styles
|
|
3
|
+
*
|
|
4
|
+
* Exports CSS as strings for injection into components.
|
|
5
|
+
*/
|
|
6
|
+
import variablesCss from './variables.css';
|
|
7
|
+
import globalCss from './global.css';
|
|
8
|
+
export { variablesCss, globalCss };
|
|
9
|
+
/**
|
|
10
|
+
* Injects global styles into the document head.
|
|
11
|
+
* Safe to call multiple times - will only inject once.
|
|
12
|
+
*/
|
|
13
|
+
export declare function addGlobalStyles(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a template element with styles and HTML content.
|
|
16
|
+
* Caches the template for reuse.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createTemplate(name: string, html: string): () => HTMLTemplateElement;
|
|
19
|
+
/**
|
|
20
|
+
* Combines CSS and HTML into a template string.
|
|
21
|
+
*/
|
|
22
|
+
export declare function templateWithStyles(css: string, html: string): string;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|