@vkontakte/videoplayer-statistics 1.0.113-dev.888965e7d.0 → 1.0.113-dev.fc8d8316c.0

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.
@@ -1,5 +1,9 @@
1
1
  import type { ILogCustomData } from "./types";
2
- export type Operation = "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" | "adv" | "playing";
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 Mode {
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 ModeAliases: Record<Mode, string>;
101
+ export declare const SurfaceModeAliases: Record<SurfaceMode, string>;
@@ -3,11 +3,11 @@ import type { IUIEvents as IUIEventsThinOneStat } from "../thinOneStat";
3
3
  import type { IPlayer } 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 ModeControllerDependencies {
6
+ export interface SurfaceModeControllerDependencies {
7
7
  uiEvents: IUIEventsOneStat | IUIEventsThinOneStat;
8
8
  initExternalSubscribers: (surfaceObservable$: IObservable<Surface | undefined>) => void;
9
9
  subscribe: <T>(observable: IObservable<T> | undefined, logger: IListener<T>) => void;
10
10
  player?: IPlayer;
11
11
  }
12
12
  /** конроллер для состояния mode плеера */
13
- export declare const useModeController: ({ uiEvents, initExternalSubscribers, subscribe, player }: ModeControllerDependencies) => void;
13
+ export declare const useSurfaceModeController: ({ uiEvents, initExternalSubscribers, subscribe, player }: SurfaceModeControllerDependencies) => void;
@@ -2,8 +2,8 @@ import type { IError, IObservable, ISubject, ISubscription, IValueObservable, IV
2
2
  import { ErrorCategory } from "@vkontakte/videoplayer-shared";
3
3
  import type { IPlayer } from "@vkontakte/videoplayer-core";
4
4
  import type { IOptionalConfig } from "./config";
5
- import type { Mode, Quality, Visibility, ConnectionType, ContentType } from "./values";
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,6 +25,18 @@ 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
42
  attachTo(player: IPlayer, adsEvents: IAdsEvents): ISubscription;
@@ -123,7 +135,7 @@ export interface IPlaybackStartedPayload {
123
135
  muted?: boolean;
124
136
  sound_volume?: number;
125
137
  buffer_time?: Milliseconds;
126
- mode?: 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?: Mode;
225
+ mode?: SurfaceMode;
214
226
  }
215
227
  export interface IVisibilityChangedPayload {
216
228
  visibility?: Visibility;
@@ -318,6 +330,7 @@ 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?;
@@ -352,6 +365,9 @@ export declare class ThinOneStat implements IThinOneStat {
352
365
  attachTo(player: IPlayer, adsEvents: IAdsEvents): ISubscription;
353
366
  attachToUi(events: IUIEvents): ISubscription;
354
367
  attachToAds(events: IAdsEvents): ISubscription;
368
+ setSessionMode(mode: SessionMode): void;
369
+ pause(): void;
370
+ resume(): void;
355
371
  getDeviceId(): string;
356
372
  resetViewSession(): void;
357
373
  destroy(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  export { ThinOneStat } from "./ThinOneStat";
2
2
  export type { IThinOneStat, IStatContext } from "./ThinOneStat";
3
- export { ActionSeekType } from "./values";
3
+ export { ActionSeekType, SessionMode } from "./values";
4
4
  export type { ActionQualityType } from "./values";
5
5
  export type { IUIEvents } from "./events";
6
6
  export { VERSION } from "../env";
@@ -0,0 +1,2 @@
1
+ import type { EventName, AdvEventName } from "../values";
2
+ export declare const isAdvEvent: (eventName: EventName) => eventName is AdvEventName;
@@ -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, Mode, Quality, StreamingProfile, Visibility } from "../values";
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) => Mode | undefined;
10
+ export declare const mode: (surface?: Surface, isPreviewPlayerView?: boolean) => SurfaceMode | undefined;
11
11
  export declare const visibility: (surface?: Surface) => Visibility | undefined;
@@ -1,5 +1,9 @@
1
1
  import type { VideoQuality } from "@vkontakte/videoplayer-shared";
2
- export type EventName = "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" | "adv_configuration" | "adv_request" | "adv_break_started" | "adv_break_ended" | "adv_error";
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];
3
7
  export declare const onceEvents: EventName[];
4
8
  export declare enum ApiEnv {
5
9
  PROD = "prod",
@@ -60,7 +64,7 @@ export declare enum StreamingProfile {
60
64
  LIVE = "live",
61
65
  VOD = "vod"
62
66
  }
63
- export declare enum Mode {
67
+ export declare enum SurfaceMode {
64
68
  INLINE = "inline",
65
69
  FULLSCREEN = "fullscreen",
66
70
  PIP_EXTERNAL = "pip_external",
@@ -74,6 +78,15 @@ export declare enum Visibility {
74
78
  FOREGROUND = "foreground",
75
79
  BACKGROUND = "background"
76
80
  }
81
+ /**
82
+ * Режим отправки статистики
83
+ * `COMMON` - обычная отправка всех событий
84
+ * `ADV` - играется реклама, отправляются только рекламные события
85
+ */
86
+ export declare enum SessionMode {
87
+ ADV = "adv",
88
+ COMMON = "common"
89
+ }
77
90
  export declare enum ActionSeekType {
78
91
  SLIDER = "slider",
79
92
  RICH = "rich",