@gcorevideo/player 2.19.15 → 2.20.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/assets/level-selector/list.ejs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.css +1634 -1634
- package/dist/index.js +585 -416
- package/dist/player.d.ts +268 -72
- package/dist/plugins/index.css +1567 -1567
- package/dist/plugins/index.js +526 -357
- package/docs/api/player.clapprnerdstats.md +12 -259
- package/docs/api/player.dvrcontrols.md +5 -1
- package/docs/api/player.errorscreen.attributes.md +3 -0
- package/docs/api/player.errorscreen.bindevents.md +3 -0
- package/docs/api/player.errorscreen.container.md +3 -0
- package/docs/api/player.errorscreen.hide.md +3 -0
- package/docs/api/player.errorscreen.md +27 -0
- package/docs/api/player.errorscreen.name.md +3 -0
- package/docs/api/player.errorscreen.render.md +3 -0
- package/docs/api/player.errorscreen.show.md +3 -0
- package/docs/api/player.errorscreen.supportedversion.md +3 -0
- package/docs/api/player.errorscreen.template.md +3 -0
- package/docs/api/player.errorscreen.unbindevents.md +3 -0
- package/docs/api/{player.playbackrate.template.md → player.initeventdata.event.md} +3 -3
- package/docs/api/{player.playbackrate.updateplaybackrate.md → player.initeventdata.md} +15 -11
- package/docs/api/player.md +88 -5
- package/docs/api/player.pictureinpicture.md +9 -197
- package/docs/api/player.playbackrate.md +10 -314
- package/docs/api/{player.playbackrate.onplay.md → player.stalleventdata.count.md} +5 -7
- package/docs/api/{player.playbackrate.name.md → player.stalleventdata.event.md} +3 -3
- package/docs/api/player.stalleventdata.md +112 -0
- package/docs/api/player.stalleventdata.time.md +13 -0
- package/docs/api/player.stalleventdata.total_ms.md +13 -0
- package/docs/api/{player.pluginsettings.md → player.starteventdata.event.md} +3 -5
- package/docs/api/{player.playbackrate.onrateselect.md → player.starteventdata.md} +15 -11
- package/docs/api/{player.statistics._constructor_.md → player.telemetry._constructor_.md} +6 -3
- package/docs/api/player.telemetry.md +146 -0
- package/docs/api/{player.volumefade.name.md → player.telemetry.name.md} +4 -2
- package/docs/api/{player.clapprnerdstats.supportedversion.md → player.telemetry.supportedversion.md} +4 -2
- package/docs/api/player.telemetryevent.md +89 -0
- package/docs/api/player.telemetryeventdata.md +15 -0
- package/docs/api/player.telemetrypluginsettings.md +57 -0
- package/docs/api/player.telemetrypluginsettings.send.md +13 -0
- package/docs/api/player.telemetryrecord.md +17 -0
- package/docs/api/player.volumefade.md +0 -93
- package/docs/api/{player.pictureinpicture.name.md → player.watcheventdata.event.md} +3 -3
- package/docs/api/{player.playbackrate.setselectedrate.md → player.watcheventdata.md} +15 -11
- package/lib/index.plugins.d.ts +2 -2
- package/lib/index.plugins.d.ts.map +1 -1
- package/lib/index.plugins.js +2 -2
- package/lib/playback/hls-playback/HlsPlayback.js +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +38 -5
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +63 -17
- package/lib/plugins/dvr-controls/DvrControls.d.ts +5 -2
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +5 -2
- package/lib/plugins/error-screen/ErrorScreen.d.ts +5 -0
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +5 -0
- package/lib/plugins/index.d.ts +2 -3
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/index.js +2 -3
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +32 -4
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -1
- package/lib/plugins/picture-in-picture/PictureInPicture.js +30 -2
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +47 -14
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -1
- package/lib/plugins/playback-rate/PlaybackRate.js +38 -9
- package/lib/plugins/statistics/Statistics.d.ts +38 -3
- package/lib/plugins/statistics/Statistics.d.ts.map +1 -1
- package/lib/plugins/statistics/Statistics.js +51 -9
- package/lib/plugins/telemetry/Telemetry.d.ts +135 -0
- package/lib/plugins/telemetry/Telemetry.d.ts.map +1 -0
- package/lib/plugins/telemetry/Telemetry.js +180 -0
- package/lib/plugins/volume-fade/VolumeFade.d.ts +7 -1
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -1
- package/lib/plugins/volume-fade/VolumeFade.js +8 -1
- package/package.json +1 -1
- package/src/index.plugins.ts +2 -2
- package/src/playback/hls-playback/HlsPlayback.ts +1 -1
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +240 -173
- package/src/plugins/dvr-controls/DvrControls.ts +5 -2
- package/src/plugins/error-screen/ErrorScreen.ts +5 -0
- package/src/plugins/index.ts +2 -3
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +47 -26
- package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +18 -18
- package/src/plugins/picture-in-picture/PictureInPicture.ts +35 -7
- package/src/plugins/playback-rate/PlaybackRate.ts +53 -24
- package/src/plugins/telemetry/Telemetry.ts +299 -0
- package/src/plugins/volume-fade/VolumeFade.ts +9 -2
- package/temp/player.api.json +2322 -3281
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.clapprnerdstats.attributes.md +0 -17
- package/docs/api/player.clapprnerdstats.bindevents.md +0 -18
- package/docs/api/player.clapprnerdstats.events.md +0 -18
- package/docs/api/player.clapprnerdstats.name.md +0 -14
- package/docs/api/player.clapprnerdstats.playerheight.md +0 -14
- package/docs/api/player.clapprnerdstats.playerwidth.md +0 -14
- package/docs/api/player.clapprnerdstats.render.md +0 -18
- package/docs/api/player.clapprnerdstats.statsboxelem.md +0 -14
- package/docs/api/player.clapprnerdstats.statsboxwidththreshold.md +0 -14
- package/docs/api/player.clapprnerdstats.template.md +0 -14
- package/docs/api/player.pictureinpicture.bindevents.md +0 -15
- package/docs/api/player.pictureinpicture.events.md +0 -13
- package/docs/api/player.pictureinpicture.exitpictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.render.md +0 -15
- package/docs/api/player.pictureinpicture.requestpictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.supportedversion.md +0 -13
- package/docs/api/player.pictureinpicture.togglepictureinpicture.md +0 -15
- package/docs/api/player.pictureinpicture.version.md +0 -11
- package/docs/api/player.pictureinpicture.videoelement.md +0 -11
- package/docs/api/player.playbackrate.attributes.md +0 -14
- package/docs/api/player.playbackrate.bindevents.md +0 -15
- package/docs/api/player.playbackrate.events.md +0 -15
- package/docs/api/player.playbackrate.gettitle.md +0 -15
- package/docs/api/player.playbackrate.goback.md +0 -15
- package/docs/api/player.playbackrate.highlightcurrentrate.md +0 -15
- package/docs/api/player.playbackrate.onfinishad.md +0 -15
- package/docs/api/player.playbackrate.onshowmenu.md +0 -15
- package/docs/api/player.playbackrate.onstartad.md +0 -15
- package/docs/api/player.playbackrate.onstop.md +0 -15
- package/docs/api/player.playbackrate.reload.md +0 -15
- package/docs/api/player.playbackrate.render.md +0 -15
- package/docs/api/player.playbackrate.supportedversion.md +0 -13
- package/docs/api/player.playbackrate.unbindevents.md +0 -15
- package/docs/api/player.statistics.bindevents.md +0 -15
- package/docs/api/player.statistics.md +0 -141
- package/docs/api/player.statistics.name.md +0 -11
- package/docs/api/player.statistics.supportedversion.md +0 -13
- package/docs/api/player.volumefade.bindevents.md +0 -18
- package/docs/api/player.volumefade.unbindevents.md +0 -18
- package/src/plugins/statistics/Statistics.ts +0 -207
- /package/src/plugins/{statistics → telemetry}/Statistics copy.xts +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [Statistics](./player.statistics.md)
|
|
4
|
-
|
|
5
|
-
## Statistics class
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
export declare class Statistics extends ContainerPlugin
|
|
11
|
-
```
|
|
12
|
-
**Extends:** ContainerPlugin
|
|
13
|
-
|
|
14
|
-
## Constructors
|
|
15
|
-
|
|
16
|
-
<table><thead><tr><th>
|
|
17
|
-
|
|
18
|
-
Constructor
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</th><th>
|
|
22
|
-
|
|
23
|
-
Modifiers
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</th><th>
|
|
27
|
-
|
|
28
|
-
Description
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</th></tr></thead>
|
|
32
|
-
<tbody><tr><td>
|
|
33
|
-
|
|
34
|
-
[(constructor)(container)](./player.statistics._constructor_.md)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</td><td>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</td><td>
|
|
41
|
-
|
|
42
|
-
Constructs a new instance of the `Statistics` class
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</td></tr>
|
|
46
|
-
</tbody></table>
|
|
47
|
-
|
|
48
|
-
## Properties
|
|
49
|
-
|
|
50
|
-
<table><thead><tr><th>
|
|
51
|
-
|
|
52
|
-
Property
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</th><th>
|
|
56
|
-
|
|
57
|
-
Modifiers
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</th><th>
|
|
61
|
-
|
|
62
|
-
Type
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</th><th>
|
|
66
|
-
|
|
67
|
-
Description
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</th></tr></thead>
|
|
71
|
-
<tbody><tr><td>
|
|
72
|
-
|
|
73
|
-
[name](./player.statistics.name.md)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</td><td>
|
|
77
|
-
|
|
78
|
-
`readonly`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</td><td>
|
|
82
|
-
|
|
83
|
-
string
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</td><td>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</td></tr>
|
|
90
|
-
<tr><td>
|
|
91
|
-
|
|
92
|
-
[supportedVersion](./player.statistics.supportedversion.md)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</td><td>
|
|
96
|
-
|
|
97
|
-
`readonly`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</td><td>
|
|
101
|
-
|
|
102
|
-
{ min: string; }
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</td><td>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</td></tr>
|
|
109
|
-
</tbody></table>
|
|
110
|
-
|
|
111
|
-
## Methods
|
|
112
|
-
|
|
113
|
-
<table><thead><tr><th>
|
|
114
|
-
|
|
115
|
-
Method
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</th><th>
|
|
119
|
-
|
|
120
|
-
Modifiers
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
</th><th>
|
|
124
|
-
|
|
125
|
-
Description
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</th></tr></thead>
|
|
129
|
-
<tbody><tr><td>
|
|
130
|
-
|
|
131
|
-
[bindEvents()](./player.statistics.bindevents.md)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</td><td>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
</td><td>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</td></tr>
|
|
141
|
-
</tbody></table>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [Statistics](./player.statistics.md) > [name](./player.statistics.name.md)
|
|
4
|
-
|
|
5
|
-
## Statistics.name property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
get name(): string;
|
|
11
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [Statistics](./player.statistics.md) > [supportedVersion](./player.statistics.supportedversion.md)
|
|
4
|
-
|
|
5
|
-
## Statistics.supportedVersion property
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
get supportedVersion(): {
|
|
11
|
-
min: string;
|
|
12
|
-
};
|
|
13
|
-
```
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [VolumeFade](./player.volumefade.md) > [bindEvents](./player.volumefade.bindevents.md)
|
|
4
|
-
|
|
5
|
-
## VolumeFade.bindEvents() method
|
|
6
|
-
|
|
7
|
-
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
**Signature:**
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
bindEvents(): void;
|
|
14
|
-
```
|
|
15
|
-
**Returns:**
|
|
16
|
-
|
|
17
|
-
void
|
|
18
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@gcorevideo/player](./player.md) > [VolumeFade](./player.volumefade.md) > [unBindEvents](./player.volumefade.unbindevents.md)
|
|
4
|
-
|
|
5
|
-
## VolumeFade.unBindEvents() method
|
|
6
|
-
|
|
7
|
-
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
**Signature:**
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
unBindEvents(): void;
|
|
14
|
-
```
|
|
15
|
-
**Returns:**
|
|
16
|
-
|
|
17
|
-
void
|
|
18
|
-
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
// An example implementation of client side performancestatistics
|
|
2
|
-
import { Container, ContainerPlugin, Events, Playback } from '@clappr/core'
|
|
3
|
-
import type { TimePosition, TimeValue } from '../../playback.types.js'
|
|
4
|
-
import type { PlaybackType } from '../..//types'
|
|
5
|
-
import { reportError } from '@gcorevideo/utils'
|
|
6
|
-
import assert from 'assert'
|
|
7
|
-
|
|
8
|
-
import { CLAPPR_VERSION } from '../../build.js'
|
|
9
|
-
|
|
10
|
-
const CUSTOM_EVENTS_CONTAINER_START = 'container:start'
|
|
11
|
-
|
|
12
|
-
const WATCH_CUTOFF = 5
|
|
13
|
-
|
|
14
|
-
const HEATMAP_INTERVAL = 10
|
|
15
|
-
|
|
16
|
-
type StatisticsEventData = Record<string, string | number | boolean>
|
|
17
|
-
|
|
18
|
-
type StatisticsRecord = {
|
|
19
|
-
event: StatisticsEvent
|
|
20
|
-
type: PlaybackType
|
|
21
|
-
} & StatisticsEventData
|
|
22
|
-
|
|
23
|
-
export type PluginSettings = {
|
|
24
|
-
/**
|
|
25
|
-
* Sends the statistics record to the storage.
|
|
26
|
-
* The actual delivery is presumably async and batched.
|
|
27
|
-
* @param data - The statistics record to send.
|
|
28
|
-
*/
|
|
29
|
-
send: (data: StatisticsRecord) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type StatisticsEvent = 'init' | 'start' | 'watch' | 'heatmap'
|
|
33
|
-
|
|
34
|
-
// TODO rewrite as core plugin
|
|
35
|
-
export class Statistics extends ContainerPlugin {
|
|
36
|
-
get name() {
|
|
37
|
-
return 'statistics_gplayer'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get supportedVersion() {
|
|
41
|
-
return { min: CLAPPR_VERSION }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private started = false
|
|
45
|
-
|
|
46
|
-
private timeStart = 0
|
|
47
|
-
|
|
48
|
-
private heatmapSent = false
|
|
49
|
-
|
|
50
|
-
private heatmapLastTime = 0
|
|
51
|
-
|
|
52
|
-
private watchSent = false
|
|
53
|
-
|
|
54
|
-
private bufTracking = false
|
|
55
|
-
|
|
56
|
-
private lags = 0
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The time when buffering last started.
|
|
60
|
-
*/
|
|
61
|
-
private bufLastStarted = 0
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The accumulated buffering duration.
|
|
65
|
-
*/
|
|
66
|
-
private bufAccDuration = 0
|
|
67
|
-
|
|
68
|
-
constructor(container: Container) {
|
|
69
|
-
super(container)
|
|
70
|
-
assert(
|
|
71
|
-
this.options.statistics &&
|
|
72
|
-
typeof this.options.statistics.send === 'function',
|
|
73
|
-
'Statistics plugin requires statistics options',
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
override bindEvents() {
|
|
78
|
-
// TODO remove this
|
|
79
|
-
this.listenToOnce(
|
|
80
|
-
this.container,
|
|
81
|
-
CUSTOM_EVENTS_CONTAINER_START,
|
|
82
|
-
this.onStart,
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
this.listenToOnce(this.container, Events.CONTAINER_READY, this.onReady)
|
|
86
|
-
this.listenTo(
|
|
87
|
-
this.container,
|
|
88
|
-
Events.CONTAINER_STATE_BUFFERING,
|
|
89
|
-
this.onBuffering,
|
|
90
|
-
)
|
|
91
|
-
this.listenTo(
|
|
92
|
-
this.container,
|
|
93
|
-
Events.CONTAINER_STATE_BUFFERFULL,
|
|
94
|
-
this.onBufferFull,
|
|
95
|
-
)
|
|
96
|
-
this.listenTo(
|
|
97
|
-
this.container.playback,
|
|
98
|
-
Events.PLAYBACK_TIMEUPDATE,
|
|
99
|
-
this.onTimeUpdateLive,
|
|
100
|
-
)
|
|
101
|
-
this.listenTo(
|
|
102
|
-
this.container.playback,
|
|
103
|
-
Events.PLAYBACK_LEVEL_SWITCH_START,
|
|
104
|
-
this.startLevelSwitch,
|
|
105
|
-
)
|
|
106
|
-
this.listenTo(
|
|
107
|
-
this.container.playback,
|
|
108
|
-
Events.PLAYBACK_LEVEL_SWITCH_END,
|
|
109
|
-
this.stopLevelSwitch,
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
private startLevelSwitch() {
|
|
114
|
-
this.bufTracking = false
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private stopLevelSwitch() {
|
|
118
|
-
this.bufTracking = true
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private onBuffering() {
|
|
122
|
-
if (this.bufTracking) {
|
|
123
|
-
this.bufLastStarted = performance.now()
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private onBufferFull() {
|
|
128
|
-
if (this.bufTracking && this.bufLastStarted) {
|
|
129
|
-
this.bufAccDuration += performance.now() - this.bufLastStarted
|
|
130
|
-
this.lags++
|
|
131
|
-
}
|
|
132
|
-
this.bufTracking = true
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private onReady() {
|
|
136
|
-
this.initEvent()
|
|
137
|
-
if (this.options.autoPlay) {
|
|
138
|
-
this.onStart()
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private initEvent() {
|
|
143
|
-
this.sendMessage('init')
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
private sendMessage(state: StatisticsEvent) {
|
|
147
|
-
this.send(state, {
|
|
148
|
-
// embed_url: this.options.referer,
|
|
149
|
-
// user_agent: Browser.userAgent
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private send(event: StatisticsEvent, data: StatisticsEventData = {}) {
|
|
154
|
-
;(this.options.statistics as PluginSettings).send({
|
|
155
|
-
event,
|
|
156
|
-
type: this.container.getPlaybackType(),
|
|
157
|
-
...data,
|
|
158
|
-
})
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
private sendHeatmap(time: TimeValue) {
|
|
162
|
-
const res: StatisticsEventData = {
|
|
163
|
-
buffering: Math.round(this.bufAccDuration),
|
|
164
|
-
lags: this.lags,
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
this.bufAccDuration = 0
|
|
168
|
-
this.lags = 0
|
|
169
|
-
if (this.container.getPlaybackType() === Playback.VOD) {
|
|
170
|
-
res.timestamp = time
|
|
171
|
-
}
|
|
172
|
-
this.send('heatmap', res)
|
|
173
|
-
this.heatmapSent = true
|
|
174
|
-
this.heatmapLastTime = time
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
private onTimeUpdateLive({ current }: TimePosition) {
|
|
178
|
-
// TODO check the `current` values for the live streams
|
|
179
|
-
if (!this.timeStart) {
|
|
180
|
-
this.timeStart = current
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
const elapsed = current - this.timeStart
|
|
184
|
-
const heatmapElapsed = current - this.heatmapLastTime
|
|
185
|
-
|
|
186
|
-
// TODO check if the heatmap is only needed for the live streams
|
|
187
|
-
if (!this.heatmapSent || heatmapElapsed >= HEATMAP_INTERVAL) {
|
|
188
|
-
this.sendHeatmap(current)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!this.watchSent && elapsed >= WATCH_CUTOFF) {
|
|
192
|
-
this.watchSent = true
|
|
193
|
-
this.sendMessage('watch')
|
|
194
|
-
}
|
|
195
|
-
} catch (error) {
|
|
196
|
-
reportError(error)
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
private onStart() {
|
|
201
|
-
if (this.started) {
|
|
202
|
-
return
|
|
203
|
-
}
|
|
204
|
-
this.started = true
|
|
205
|
-
this.sendMessage('start')
|
|
206
|
-
}
|
|
207
|
-
}
|
|
File without changes
|