@vkontakte/videoplayer-statistics 1.0.113 → 1.0.114-beta.1
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/es2015.cjs +4 -4
- package/es2015.esm.js +4 -4
- package/esnext.cjs +4 -4
- package/esnext.esm.js +4 -4
- package/evergreen.esm.js +4 -4
- package/package.json +3 -3
- package/types/oneStat/OneStat.d.ts +12 -6
- package/types/oneStat/index.d.ts +4 -3
- package/types/oneStat/playerAdapter.d.ts +7 -0
- package/types/oneStat/types.d.ts +2 -2
- package/types/oneStat/utils/mappers.d.ts +2 -2
- package/types/oneStat/utils/operation.d.ts +2 -0
- package/types/oneStat/utils/watchCoverage.d.ts +2 -2
- package/types/oneStat/values.d.ts +16 -3
- package/types/shared/{useModeController.d.ts → useSurfaceModeController.d.ts} +7 -4
- package/types/thinOneStat/ThinOneStat.d.ts +25 -8
- package/types/thinOneStat/config.d.ts +1 -0
- package/types/thinOneStat/index.d.ts +2 -1
- package/types/thinOneStat/playerAdapter.d.ts +8 -0
- package/types/thinOneStat/utils/calculateTotalViewTime.d.ts +3 -2
- package/types/thinOneStat/utils/downloadBytes.d.ts +2 -2
- package/types/thinOneStat/utils/eventName.d.ts +2 -0
- package/types/thinOneStat/utils/mappers.d.ts +2 -2
- package/types/thinOneStat/utils/telemetry.d.ts +2 -2
- package/types/thinOneStat/utils/watchCoverage.d.ts +2 -2
- package/types/thinOneStat/utils/watchedN.d.ts +2 -2
- package/types/thinOneStat/values.d.ts +16 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpConnectionType as CoreConnectionType, Surface, VideoFormat, VideoQuality } from "@vkontakte/videoplayer-core";
|
|
2
|
-
import { ConnectionType as StatisticsConnectionType, ContentType,
|
|
2
|
+
import { ConnectionType as StatisticsConnectionType, ContentType, SurfaceMode, Network, Quality } from "../values";
|
|
3
3
|
export declare const quality: (coreQuality: VideoQuality | undefined) => Quality | undefined;
|
|
4
4
|
export declare const connectionType: (coreType: CoreConnectionType | undefined) => StatisticsConnectionType | undefined;
|
|
5
5
|
export declare const contentType: (format: VideoFormat | undefined) => ContentType | undefined;
|
|
6
|
-
export declare const surface: (surface: Surface | undefined, isPreviewPlayerView?: boolean) =>
|
|
6
|
+
export declare const surface: (surface: Surface | undefined, isPreviewPlayerView?: boolean) => SurfaceMode | undefined;
|
|
7
7
|
export declare const network: (effectiveType: "slow-2g" | "2g" | "3g" | "4g" | string) => Network | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IOneStatPlayerAdapter } from "../playerAdapter";
|
|
2
2
|
import type { IObservable, IRange, Milliseconds, Seconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
export type IParams = {
|
|
4
4
|
forceInterval: Milliseconds;
|
|
5
5
|
watchCoverageTimeoutFix: boolean;
|
|
6
6
|
watchCoverageExactTime: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const watchCoverage: (player:
|
|
8
|
+
export declare const watchCoverage: (player: IOneStatPlayerAdapter, params: IParams) => IObservable<IRange<Seconds>>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ILogCustomData } from "./types";
|
|
2
|
-
export type Operation =
|
|
2
|
+
export type Operation = CommonOperation | AdvOperation;
|
|
3
|
+
export declare const COMMON_OPERATIONS: readonly ["action_play", "action_play_interactive", "first_bytes", "player_ready", "first_frame", "seek", "watch_coverage_record", "watch_coverage_live", "empty_buffer", "action_stop", "close_at_empty_buffer", "content_error", "player_interface_click", "next_movie", "track_switch", "failover", "quality", "play_toggle", "pause", "playing"];
|
|
4
|
+
export type CommonOperation = (typeof COMMON_OPERATIONS)[number];
|
|
5
|
+
export declare const ADV_OPERATIONS: readonly ["adv"];
|
|
6
|
+
export type AdvOperation = (typeof ADV_OPERATIONS)[number];
|
|
3
7
|
export declare enum ApiEnv {
|
|
4
8
|
PROD = "prod",
|
|
5
9
|
VK_ALIAS = "vk_alias",
|
|
@@ -54,7 +58,7 @@ export declare enum Network {
|
|
|
54
58
|
GOOD = "good",
|
|
55
59
|
POOR = "poor"
|
|
56
60
|
}
|
|
57
|
-
export declare enum
|
|
61
|
+
export declare enum SurfaceMode {
|
|
58
62
|
PIP = "pip",
|
|
59
63
|
FULLSCREEN = "fullscreen",
|
|
60
64
|
EXTERNAL = "external",
|
|
@@ -64,6 +68,15 @@ export declare enum Mode {
|
|
|
64
68
|
INVISIBLE = "invisible",
|
|
65
69
|
MINIMAL = "minimal"
|
|
66
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Режим отправки статистики
|
|
73
|
+
* `COMMON` - обычная отправка всех событий
|
|
74
|
+
* `ADV` - играется реклама, отправляются только рекламные события
|
|
75
|
+
*/
|
|
76
|
+
export declare enum SessionMode {
|
|
77
|
+
ADV = "adv",
|
|
78
|
+
COMMON = "common"
|
|
79
|
+
}
|
|
67
80
|
export declare enum SeekAction {
|
|
68
81
|
SLIDER = "slider",
|
|
69
82
|
RICH = "rich",
|
|
@@ -85,4 +98,4 @@ export type InterfaceClick = InteractiveInterfaceClick;
|
|
|
85
98
|
export declare const OperationAliases: Partial<Record<Operation, string>>;
|
|
86
99
|
export declare const CustomParamAliases: Partial<Record<keyof ILogCustomData, string>>;
|
|
87
100
|
export declare const QualityAliases: Record<Quality, string>;
|
|
88
|
-
export declare const
|
|
101
|
+
export declare const SurfaceModeAliases: Record<SurfaceMode, string>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { IUIEvents as IUIEventsOneStat } from "../oneStat";
|
|
2
2
|
import type { IUIEvents as IUIEventsThinOneStat } from "../thinOneStat";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IPlayerInfo } from "@vkontakte/videoplayer-core";
|
|
4
4
|
import { Surface } from "@vkontakte/videoplayer-core";
|
|
5
5
|
import type { IListener, IObservable } from "@vkontakte/videoplayer-shared";
|
|
6
|
-
export interface
|
|
6
|
+
export interface ISurfaceModeControllerPlayerAdapter {
|
|
7
|
+
info: Pick<IPlayerInfo, "surface$">;
|
|
8
|
+
}
|
|
9
|
+
export interface SurfaceModeControllerDependencies {
|
|
7
10
|
uiEvents: IUIEventsOneStat | IUIEventsThinOneStat;
|
|
8
11
|
initExternalSubscribers: (surfaceObservable$: IObservable<Surface | undefined>) => void;
|
|
9
12
|
subscribe: <T>(observable: IObservable<T> | undefined, logger: IListener<T>) => void;
|
|
10
|
-
player?:
|
|
13
|
+
player?: ISurfaceModeControllerPlayerAdapter;
|
|
11
14
|
}
|
|
12
15
|
/** конроллер для состояния mode плеера */
|
|
13
|
-
export declare const
|
|
16
|
+
export declare const useSurfaceModeController: ({ uiEvents, initExternalSubscribers, subscribe, player }: SurfaceModeControllerDependencies) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IError, IObservable, ISubject, ISubscription, IValueObservable, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import { ErrorCategory } from "@vkontakte/videoplayer-shared";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IThinOneStatPlayerAdapter } from "./playerAdapter";
|
|
4
4
|
import type { IOptionalConfig } from "./config";
|
|
5
|
-
import type {
|
|
6
|
-
import { ActionSeekType, AutoQuality } from "./values";
|
|
5
|
+
import type { SurfaceMode, Quality, Visibility, ConnectionType, ContentType } from "./values";
|
|
6
|
+
import { ActionSeekType, AutoQuality, SessionMode } from "./values";
|
|
7
7
|
import type { IAdsEvents, IUIEvents } from "./events";
|
|
8
8
|
export interface IThinOneStat {
|
|
9
9
|
vsid$: IValueObservable<string | undefined>;
|
|
@@ -25,9 +25,21 @@ export interface IThinOneStat {
|
|
|
25
25
|
*/
|
|
26
26
|
updateContext(context: Partial<IStatContext>): void;
|
|
27
27
|
/**
|
|
28
|
+
* Устанавливает режим отправки статистики
|
|
29
|
+
*/
|
|
30
|
+
setSessionMode(mode: SessionMode): void;
|
|
31
|
+
/**
|
|
32
|
+
* Ставит отправку событий на паузу. Они будут накапливаться до вызова `resume()`
|
|
33
|
+
*/
|
|
34
|
+
pause(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Снимает паузу отправки событий и отправляет все накопленные события
|
|
37
|
+
*/
|
|
38
|
+
resume(): void;
|
|
39
|
+
/**
|
|
28
40
|
* Привязываемся к событиям и разным изменениям состояний плеера
|
|
29
41
|
*/
|
|
30
|
-
attachTo(player:
|
|
42
|
+
attachTo(player: IThinOneStatPlayerAdapter, adsEvents: IAdsEvents): ISubscription;
|
|
31
43
|
attachToUi(uiEvents: IUIEvents): ISubscription;
|
|
32
44
|
attachToAds(adsEvents: IAdsEvents): ISubscription;
|
|
33
45
|
/**
|
|
@@ -123,7 +135,7 @@ export interface IPlaybackStartedPayload {
|
|
|
123
135
|
muted?: boolean;
|
|
124
136
|
sound_volume?: number;
|
|
125
137
|
buffer_time?: Milliseconds;
|
|
126
|
-
mode?:
|
|
138
|
+
mode?: SurfaceMode;
|
|
127
139
|
visibility?: Visibility;
|
|
128
140
|
subtitles_enabled?: boolean;
|
|
129
141
|
auto_subtitles?: boolean;
|
|
@@ -210,7 +222,7 @@ export interface IViewPortChangedPayload {
|
|
|
210
222
|
player_height?: number;
|
|
211
223
|
}
|
|
212
224
|
export interface IModeChangedPayload {
|
|
213
|
-
mode?:
|
|
225
|
+
mode?: SurfaceMode;
|
|
214
226
|
}
|
|
215
227
|
export interface IVisibilityChangedPayload {
|
|
216
228
|
visibility?: Visibility;
|
|
@@ -318,10 +330,10 @@ export declare class ThinOneStat implements IThinOneStat {
|
|
|
318
330
|
private readonly onceEvents;
|
|
319
331
|
private sentOnceEvents;
|
|
320
332
|
private eventNumber;
|
|
333
|
+
private sessionMode;
|
|
321
334
|
private isStarted?;
|
|
322
335
|
private isSeeking?;
|
|
323
336
|
private inBufferStarvation?;
|
|
324
|
-
private wasPaused?;
|
|
325
337
|
private isLive?;
|
|
326
338
|
private lastContentType?;
|
|
327
339
|
private cdnHostname?;
|
|
@@ -330,6 +342,8 @@ export declare class ThinOneStat implements IThinOneStat {
|
|
|
330
342
|
private connectionType?;
|
|
331
343
|
private connectionReused?;
|
|
332
344
|
private player;
|
|
345
|
+
private loopCount;
|
|
346
|
+
private loopLimitReached;
|
|
333
347
|
private playerSize;
|
|
334
348
|
private currentSubtitle?;
|
|
335
349
|
private userQuality?;
|
|
@@ -349,9 +363,12 @@ export declare class ThinOneStat implements IThinOneStat {
|
|
|
349
363
|
authorize(authToken?: string): void;
|
|
350
364
|
reportError(payload: IReportErrorPayload): void;
|
|
351
365
|
updateContext(newContext: Partial<IStatContext>): void;
|
|
352
|
-
attachTo(player:
|
|
366
|
+
attachTo(player: IThinOneStatPlayerAdapter, adsEvents: IAdsEvents): ISubscription;
|
|
353
367
|
attachToUi(events: IUIEvents): ISubscription;
|
|
354
368
|
attachToAds(events: IAdsEvents): ISubscription;
|
|
369
|
+
setSessionMode(mode: SessionMode): void;
|
|
370
|
+
pause(): void;
|
|
371
|
+
resume(): void;
|
|
355
372
|
getDeviceId(): string;
|
|
356
373
|
resetViewSession(): void;
|
|
357
374
|
destroy(): Promise<void>;
|
|
@@ -28,6 +28,7 @@ export interface IConfig {
|
|
|
28
28
|
watchedNDefaultTargetDuration: Milliseconds;
|
|
29
29
|
telemetryInterval: Milliseconds;
|
|
30
30
|
downloadBytesMaxTime: Milliseconds;
|
|
31
|
+
maxLoops: number;
|
|
31
32
|
}
|
|
32
33
|
export type IOptionalConfig = RecursivePartial<IConfig>;
|
|
33
34
|
export declare const fillDefault: (partial: IOptionalConfig) => IConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ThinOneStat } from "./ThinOneStat";
|
|
2
2
|
export type { IThinOneStat, IStatContext } from "./ThinOneStat";
|
|
3
|
-
export {
|
|
3
|
+
export type { IThinOneStatPlayerAdapter } from "./playerAdapter";
|
|
4
|
+
export { ActionSeekType, SessionMode } from "./values";
|
|
4
5
|
export type { ActionQualityType } from "./values";
|
|
5
6
|
export type { IUIEvents } from "./events";
|
|
6
7
|
export { VERSION } from "../env";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPlayer, IPlayerInfo, IPlayerEvents } from "@vkontakte/videoplayer-core";
|
|
2
|
+
export interface IThinOneStatPlayerAdapter {
|
|
3
|
+
info: Pick<IPlayerInfo, "atLiveEdge$" | "availableSources$" | "availableTextTracks$" | "currentAudioStream$" | "currentBuffer$" | "currentFormat$" | "currentPlaybackRate$" | "currentQuality$" | "currentTextTrack$" | "currentVideoStream$" | "hostname$" | "httpConnectionMetrics$" | "httpConnectionReused$" | "httpConnectionType$" | "httpDownloadMetrics$" | "isAutoQualityEnabled$" | "isLive$" | "isStalled$" | "liveTime$" | "muted$" | "playbackState$" | "position$" | "rttEstimation$" | "stallStartTime$" | "surface$" | "videoBitrate$" | "volume$">;
|
|
4
|
+
events: Pick<IPlayerEvents, "willStart$" | "willResume$" | "willReady$" | "willSeek$" | "willStop$" | "willDestruct$" | "started$" | "playing$" | "paused$" | "seeked$" | "ended$" | "looped$" | "firstBytes$" | "firstBytesManifest$" | "firstBytesRequested$" | "firstFrame$" | "manifestRequested$" | "manifestReceived$" | "managedError$" | "fatalError$" | "fetcherRecoverableError$">;
|
|
5
|
+
experimental: Pick<IPlayer["experimental"], "element$">;
|
|
6
|
+
getExactTime: IPlayer["getExactTime"];
|
|
7
|
+
getExactLiveTime: IPlayer["getExactLiveTime"];
|
|
8
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IObservable } from "@vkontakte/videoplayer-core";
|
|
3
|
+
import type { IThinOneStatPlayerAdapter } from "../playerAdapter";
|
|
3
4
|
type GetTotalViewTime = () => Milliseconds;
|
|
4
|
-
export declare const calculateTotalViewTime: (player:
|
|
5
|
+
export declare const calculateTotalViewTime: (player: IThinOneStatPlayerAdapter) => IObservable<GetTotalViewTime>;
|
|
5
6
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IThinOneStatPlayerAdapter } from "../playerAdapter";
|
|
2
2
|
import type { IObservable } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IDownloadBytesPayload } from "../ThinOneStat";
|
|
4
4
|
export type IParams = {
|
|
5
5
|
maxTimeWindow: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const downloadBytes: (player:
|
|
7
|
+
export declare const downloadBytes: (player: IThinOneStatPlayerAdapter, { maxTimeWindow }: IParams) => IObservable<IDownloadBytesPayload>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ISources } from "@vkontakte/videoplayer-core";
|
|
2
2
|
import { HttpConnectionType as CoreConnectionType, Surface, VideoFormat, VideoQuality } from "@vkontakte/videoplayer-core";
|
|
3
|
-
import { ConnectionType as StatisticsConnectionType, ContentType,
|
|
3
|
+
import { ConnectionType as StatisticsConnectionType, ContentType, SurfaceMode, Quality, StreamingProfile, Visibility } from "../values";
|
|
4
4
|
export declare const errorTrace: (data: unknown) => string | undefined;
|
|
5
5
|
export declare const connectionType: (coreType?: CoreConnectionType) => StatisticsConnectionType | undefined;
|
|
6
6
|
export declare const contentType: (format?: VideoFormat) => ContentType | undefined;
|
|
7
7
|
export declare const quality: (coreQuality?: VideoQuality) => Quality | undefined;
|
|
8
8
|
export declare const streamingProfile: (contentType?: ContentType) => StreamingProfile | undefined;
|
|
9
9
|
export declare const formatUrl: (format?: VideoFormat, sources?: ISources, quality?: VideoQuality) => string | undefined;
|
|
10
|
-
export declare const mode: (surface?: Surface, isPreviewPlayerView?: boolean) =>
|
|
10
|
+
export declare const mode: (surface?: Surface, isPreviewPlayerView?: boolean) => SurfaceMode | undefined;
|
|
11
11
|
export declare const visibility: (surface?: Surface) => Visibility | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IThinOneStatPlayerAdapter } from "../playerAdapter";
|
|
2
2
|
import type { IObservable, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
export type IParams = {
|
|
4
4
|
interval: number;
|
|
5
5
|
getTotalViewTime: () => Milliseconds;
|
|
6
6
|
};
|
|
7
|
-
export declare const telemetry: (player:
|
|
7
|
+
export declare const telemetry: (player: IThinOneStatPlayerAdapter, params: IParams) => IObservable<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IThinOneStatPlayerAdapter } from "../playerAdapter";
|
|
2
2
|
import type { Seconds, IObservable, IRange } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IAdsEvents } from "../events";
|
|
4
4
|
export type IParams = {
|
|
5
5
|
heartbeatInterval?: Seconds;
|
|
6
6
|
exactTime: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const watchCoverage: (player:
|
|
8
|
+
export declare const watchCoverage: (player: IThinOneStatPlayerAdapter, adsEvents: IAdsEvents, params: IParams) => IObservable<IRange<Seconds>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IThinOneStatPlayerAdapter } from "../playerAdapter";
|
|
2
2
|
import type { IObservable, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IWatchedNPayload } from "../ThinOneStat";
|
|
4
4
|
export type IParams = {
|
|
5
5
|
targetDuration: Milliseconds;
|
|
6
6
|
getTotalViewTime: () => Milliseconds;
|
|
7
7
|
};
|
|
8
|
-
export declare const watchedN: (player:
|
|
8
|
+
export declare const watchedN: (player: IThinOneStatPlayerAdapter, params: IParams) => IObservable<IWatchedNPayload>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
export type EventName =
|
|
2
|
+
export type EventName = CommonEventName | AdvEventName;
|
|
3
|
+
export declare const COMMON_EVENT_NAMES: readonly ["watch_coverage", "watch_coverage_live", "watched_n", "start_session", "preload_started", "preload_ended", "preload_error", "playback_started", "play", "manifest_request", "first_media_request", "first_byte_manifest", "first_byte_media", "manifest_received", "connection_established", "first_video_frame_decoded", "ready", "playing", "pause", "resume", "seeking", "seeked", "content_end_reached", "stop", "buffer_starvation", "show_loader", "quality_change_requested", "quality_changed", "cdn_host_changed", "view_port_changed", "mode_changed", "visibility_changed", "audio_track_switched", "video_track_switched", "subtitles_switched", "sound_changed", "failover", "content_type_change", "error", "cannot_play", "download_bytes", "telemetry"];
|
|
4
|
+
export type CommonEventName = (typeof COMMON_EVENT_NAMES)[number];
|
|
5
|
+
export declare const ADV_EVENT_NAMES: readonly ["adv_configuration", "adv_request", "adv_break_started", "adv_break_ended", "adv_error"];
|
|
6
|
+
export type AdvEventName = (typeof ADV_EVENT_NAMES)[number];
|
|
7
|
+
export declare const loopCapExemptEvents: EventName[];
|
|
3
8
|
export declare const onceEvents: EventName[];
|
|
4
9
|
export declare enum ApiEnv {
|
|
5
10
|
PROD = "prod",
|
|
@@ -60,7 +65,7 @@ export declare enum StreamingProfile {
|
|
|
60
65
|
LIVE = "live",
|
|
61
66
|
VOD = "vod"
|
|
62
67
|
}
|
|
63
|
-
export declare enum
|
|
68
|
+
export declare enum SurfaceMode {
|
|
64
69
|
INLINE = "inline",
|
|
65
70
|
FULLSCREEN = "fullscreen",
|
|
66
71
|
PIP_EXTERNAL = "pip_external",
|
|
@@ -74,6 +79,15 @@ export declare enum Visibility {
|
|
|
74
79
|
FOREGROUND = "foreground",
|
|
75
80
|
BACKGROUND = "background"
|
|
76
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Режим отправки статистики
|
|
84
|
+
* `COMMON` - обычная отправка всех событий
|
|
85
|
+
* `ADV` - играется реклама, отправляются только рекламные события
|
|
86
|
+
*/
|
|
87
|
+
export declare enum SessionMode {
|
|
88
|
+
ADV = "adv",
|
|
89
|
+
COMMON = "common"
|
|
90
|
+
}
|
|
77
91
|
export declare enum ActionSeekType {
|
|
78
92
|
SLIDER = "slider",
|
|
79
93
|
RICH = "rich",
|