@stinkycomputing/web-live-player 0.1.2 → 0.1.3
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/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export * from './sources/stream-source';
|
|
|
12
12
|
export { BasePlayer } from './player/base-player';
|
|
13
13
|
export type { BasePlayerConfig } from './player/base-player';
|
|
14
14
|
export { LiveVideoPlayer, createPlayer } from './player/live-player';
|
|
15
|
-
export type { PlayerConfig, PlayerStats, PlayerState } from './player/live-player';
|
|
15
|
+
export type { PlayerConfig, PlayerStats, PlayerState, BandwidthStats } from './player/live-player';
|
|
16
16
|
export { FileVideoPlayer, createFilePlayer } from './player/file-player';
|
|
17
17
|
export type { FilePlayerConfig, FilePlayerState, FilePlayerStats, FilePlayMode } from './player/file-player';
|
|
18
18
|
export { createStandaloneMoQSource, StandaloneMoQSource } from './sources/standalone-moq-source';
|
|
@@ -30,6 +30,6 @@ export { FileAudioPlayer } from './audio/file-audio-player';
|
|
|
30
30
|
export { LiveAudioPlayer } from './audio/live-audio-player';
|
|
31
31
|
export type { LiveAudioConfig } from './audio/live-audio-player';
|
|
32
32
|
export { FrameScheduler } from './scheduling/frame-scheduler';
|
|
33
|
-
export type { FrameTiming, LatencyStats, SchedulerStatus, SchedulerConfig } from './scheduling/frame-scheduler';
|
|
33
|
+
export type { FrameTiming, LatencyStats, SchedulerStatus, SchedulerConfig, PacketTimingEntry } from './scheduling/frame-scheduler';
|
|
34
34
|
export { SesameBinaryProtocol } from './protocol/sesame-binary-protocol';
|
|
35
35
|
export type { ParsedData, HeaderData, HeaderCodecData } from './protocol/sesame-binary-protocol';
|
|
@@ -21,6 +21,14 @@ export interface PlayerConfig {
|
|
|
21
21
|
* Player state
|
|
22
22
|
*/
|
|
23
23
|
export type PlayerState = 'idle' | 'playing' | 'paused' | 'error';
|
|
24
|
+
/**
|
|
25
|
+
* Bandwidth statistics
|
|
26
|
+
*/
|
|
27
|
+
export interface BandwidthStats {
|
|
28
|
+
videoBytesPerSecond: number;
|
|
29
|
+
audioBytesPerSecond: number;
|
|
30
|
+
totalBytesPerSecond: number;
|
|
31
|
+
}
|
|
24
32
|
/**
|
|
25
33
|
* Player statistics
|
|
26
34
|
*/
|
|
@@ -36,6 +44,7 @@ export interface PlayerStats {
|
|
|
36
44
|
streamHeight: number;
|
|
37
45
|
frameRate: number;
|
|
38
46
|
latency: LatencyStats | null;
|
|
47
|
+
bandwidth: BandwidthStats | null;
|
|
39
48
|
}
|
|
40
49
|
/**
|
|
41
50
|
* Player event types
|
|
@@ -84,6 +93,13 @@ export declare class LiveVideoPlayer extends BasePlayer<PlayerState> {
|
|
|
84
93
|
private ownsAudioContext;
|
|
85
94
|
private audioCodecData;
|
|
86
95
|
private arrivalTimes;
|
|
96
|
+
private keyframeStatus;
|
|
97
|
+
private videoBytesReceived;
|
|
98
|
+
private audioBytesReceived;
|
|
99
|
+
private lastBandwidthUpdateTime;
|
|
100
|
+
private lastVideoBytesReceived;
|
|
101
|
+
private lastAudioBytesReceived;
|
|
102
|
+
private currentBandwidth;
|
|
87
103
|
constructor(config?: PlayerConfig);
|
|
88
104
|
/**
|
|
89
105
|
* Enable or disable debug logging at runtime
|
|
@@ -164,6 +180,14 @@ export declare class LiveVideoPlayer extends BasePlayer<PlayerState> {
|
|
|
164
180
|
* Get player statistics
|
|
165
181
|
*/
|
|
166
182
|
getStats(): PlayerStats;
|
|
183
|
+
/**
|
|
184
|
+
* Update bandwidth statistics
|
|
185
|
+
*/
|
|
186
|
+
private updateBandwidthStats;
|
|
187
|
+
/**
|
|
188
|
+
* Get packet timing history for visualization/debugging
|
|
189
|
+
*/
|
|
190
|
+
getPacketTimingHistory(): import('..').PacketTimingEntry[];
|
|
167
191
|
/**
|
|
168
192
|
* Subscribe to player events (typed overload)
|
|
169
193
|
*/
|
|
@@ -42,6 +42,23 @@ export interface SchedulerStatus {
|
|
|
42
42
|
driftCorrections: number;
|
|
43
43
|
latency: LatencyStats | null;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Packet timing entry for visualization
|
|
47
|
+
*/
|
|
48
|
+
export interface PacketTimingEntry {
|
|
49
|
+
/** Time packet arrived (performance.now()) */
|
|
50
|
+
arrivalTime: number;
|
|
51
|
+
/** Time since previous packet (ms) */
|
|
52
|
+
intervalMs: number;
|
|
53
|
+
/** Stream timestamp (us) */
|
|
54
|
+
streamTimestampUs: number;
|
|
55
|
+
/** Whether this was a keyframe */
|
|
56
|
+
isKeyframe: boolean;
|
|
57
|
+
/** Decode latency (ms) */
|
|
58
|
+
decodeLatencyMs: number;
|
|
59
|
+
/** Whether frame was dropped */
|
|
60
|
+
wasDropped: boolean;
|
|
61
|
+
}
|
|
45
62
|
export interface SchedulerConfig<T> {
|
|
46
63
|
/** Target buffer delay in milliseconds (0 = bypass mode, always return latest) */
|
|
47
64
|
bufferDelayMs?: number;
|
|
@@ -81,6 +98,9 @@ export declare class FrameScheduler<T> {
|
|
|
81
98
|
private dequeueCount;
|
|
82
99
|
private latencyHistory;
|
|
83
100
|
private latencyHistorySize;
|
|
101
|
+
private packetTimingHistory;
|
|
102
|
+
private packetTimingHistorySize;
|
|
103
|
+
private lastPacketArrivalTime;
|
|
84
104
|
private stats;
|
|
85
105
|
private logger;
|
|
86
106
|
private onFrameDropped?;
|
|
@@ -90,7 +110,7 @@ export declare class FrameScheduler<T> {
|
|
|
90
110
|
/** Effective drift threshold - scales with buffer target for low-latency mode */
|
|
91
111
|
private get effectiveDriftThresholdMs();
|
|
92
112
|
/** Enqueue a decoded frame with timing information */
|
|
93
|
-
enqueue(frame: T, timestampUs: number, timing: FrameTiming): void;
|
|
113
|
+
enqueue(frame: T, timestampUs: number, timing: FrameTiming, isKeyframe?: boolean): void;
|
|
94
114
|
/** Dequeue frame for rendering at given real time (milliseconds) */
|
|
95
115
|
dequeue(realTimeMs: number): T | null;
|
|
96
116
|
/** Bypass mode: return latest frame, drop rest */
|
|
@@ -119,4 +139,6 @@ export declare class FrameScheduler<T> {
|
|
|
119
139
|
logStatus(): void;
|
|
120
140
|
/** Reset statistics */
|
|
121
141
|
resetStats(): void;
|
|
142
|
+
/** Get packet timing history for visualization */
|
|
143
|
+
getPacketTimingHistory(): PacketTimingEntry[];
|
|
122
144
|
}
|