forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
94 lines (84 loc) · 1.93 KB
/
Copy pathtypes.ts
File metadata and controls
94 lines (84 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { MediaPlayerEvent, YouTube } from './contexts';
import { SnowplowEvent } from './snowplowEvents';
import { YTPlayerEvent, YTState } from './constants';
export type EventGroup = (SnowplowEvent | YTPlayerEvent | YTState | string)[];
export interface TrackingOptions {
mediaId: string;
player?: YT.Player;
urlParameters?: UrlParameters;
captureEvents: EventGroup;
youtubeEvents: YTPlayerEvent[];
label?: string;
updateRate?: number;
progress?: {
boundaries: number[];
boundaryTimeoutIds: ReturnType<typeof setTimeout>[];
};
}
export interface MediaTrackingOptions {
boundaries?: number[];
captureEvents?: EventGroup;
label?: string;
updateRate?: number;
}
export interface SnowplowYouTubeData {
percent?: number;
[key: string]: number | undefined;
}
export interface MediaEventData {
schema: string;
data: MediaPlayerEvent;
context: MediaEntities[];
}
export interface MediaEntities {
schema: string;
data: YouTube | SnowplowYouTubeData | SnowplowMediaPlayer;
}
export interface SnowplowMediaPlayer {
currentTime: number;
duration: number;
ended: boolean;
loop: boolean;
muted: boolean;
paused: boolean;
playbackRate: number;
volume: number;
percentProgress?: number;
[key: string]: unknown;
}
export interface TrackedPlayer {
player: YT.Player;
conf: TrackingOptions;
seekTracking: {
prevTime: number;
enabled: boolean;
};
volumeTracking: {
prevVolume: number;
enabled: boolean;
};
}
export interface EventData {
error?: string;
percentThrough?: number;
}
export interface UrlParameters {
autoplay?: String;
controls?: String;
diablekb?: String;
enablejsapi?: String;
end?: String;
fs?: String;
iv_load_policy?: String;
hl?: String;
list?: String;
listType?: String;
loop?: String;
modestbranding?: String;
origin?: String;
playlist?: String;
playsinline?: String;
rel?: String;
start?: String;
widget_referrer?: String;
}