@gumlet/insights-js-core 1.1.4 → 1.1.5
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/build/release/gumlet-insights.min.js +2 -0
- package/build/release/gumlet-insights.min.js.LICENSE.txt +10 -0
- package/build/release/package.json +1 -0
- package/package.json +3 -2
- package/.github/workflows/main.yml +0 -87
- package/.gitlab-ci.yml +0 -54
- package/bitbucket-pipelines.yml +0 -35
- package/docs/payload-documentation.md +0 -72
- package/html/bitmovin.html +0 -82
- package/html/dashjs.html +0 -55
- package/html/hlsjs.html +0 -72
- package/html/html5.html +0 -59
- package/html/shaka.html +0 -102
- package/html/videojs.html +0 -67
- package/index.html +0 -73
- package/jest.config.js +0 -187
- package/js/adapters/Bitmovin7Adapter.js +0 -352
- package/js/adapters/BitmovinAdapter.js +0 -198
- package/js/adapters/DashjsAdapter.js +0 -140
- package/js/adapters/HTML5Adapter.js +0 -774
- package/js/adapters/HlsjsAdapter.js +0 -152
- package/js/adapters/ShakaAdapter.js +0 -81
- package/js/adapters/VideoJsAdapter.js +0 -455
- package/js/analyticsStateMachines/Bitmovin7AnalyticsStateMachine.js +0 -471
- package/js/analyticsStateMachines/BitmovinAnalyticsStateMachine.js +0 -299
- package/js/analyticsStateMachines/HTML5AnalyticsStateMachine.js +0 -443
- package/js/analyticsStateMachines/VideoJsAnalyticsStateMachine.js +0 -503
- package/js/cast/CastClient.js +0 -50
- package/js/cast/CastReceiver.js +0 -37
- package/js/core/AdapterFactory.js +0 -41
- package/js/core/Analytics.js +0 -1367
- package/js/core/AnalyticsStateMachineFactory.js +0 -36
- package/js/core/GumletInsightsExport.js +0 -81
- package/js/enums/CDNProviders.js +0 -11
- package/js/enums/Events.js +0 -32
- package/js/enums/GumletEnum.js +0 -19
- package/js/enums/MIMETypes.js +0 -30
- package/js/enums/Players.js +0 -11
- package/js/enums/StreamTypes.js +0 -15
- package/js/utils/EventsCall.js +0 -22
- package/js/utils/HttpCall.js +0 -57
- package/js/utils/LicenseCall.js +0 -18
- package/js/utils/Logger.js +0 -40
- package/js/utils/PlayerDetector.js +0 -75
- package/js/utils/PlayerInitCall.js +0 -22
- package/js/utils/SessionCreationCall.js +0 -22
- package/js/utils/Settings.js +0 -3
- package/js/utils/Utils.js +0 -195
- package/precommit.bash +0 -8
- package/tests/stage1.test.js +0 -50
- package/webpack.config.debug.js +0 -34
- package/webpack.config.js +0 -40
- package/webpack.config.release.js +0 -62
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import Events from '../enums/Events';
|
|
2
|
-
|
|
3
|
-
class BitmovinAdapter {
|
|
4
|
-
constructor(player, eventCallback) {
|
|
5
|
-
this.onBeforeUnLoadEvent = false;
|
|
6
|
-
this.player = player;
|
|
7
|
-
this.eventCallback = eventCallback;
|
|
8
|
-
this.register();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
register() {
|
|
12
|
-
this.player.addEventHandler(this.player.EVENT.ON_SOURCE_LOADED, () => {
|
|
13
|
-
this.eventCallback(Events.SOURCE_LOADED);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
this.player.addEventHandler(this.player.EVENT.ON_READY, () => {
|
|
17
|
-
let autoplay = false;
|
|
18
|
-
if (this.player.getConfig().playback && this.player.getConfig().playback.autoplay) {
|
|
19
|
-
autoplay = this.player.getConfig().playback.autoplay;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
this.eventCallback(Events.READY, {
|
|
23
|
-
isLive : this.player.isLive(),
|
|
24
|
-
version : this.player.getVersion(),
|
|
25
|
-
type : this.player.getPlayerType(),
|
|
26
|
-
duration : this.player.getDuration(),
|
|
27
|
-
streamType : this.player.getStreamType(),
|
|
28
|
-
videoId : this.player.getConfig().source.videoId,
|
|
29
|
-
userId : this.player.getConfig().source.userId,
|
|
30
|
-
mpdUrl : this.player.getConfig().source.dash,
|
|
31
|
-
m3u8Url : this.player.getConfig().source.hls,
|
|
32
|
-
progUrl : this.player.getConfig().source.progressive,
|
|
33
|
-
videoWindowWidth : this.player.getFigure().offsetWidth,
|
|
34
|
-
videoWindowHeight: this.player.getFigure().offsetHeight,
|
|
35
|
-
isMuted : this.player.isMuted(),
|
|
36
|
-
autoplay
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
this.player.addEventHandler(this.player.EVENT.ON_CAST_START, () => {
|
|
41
|
-
this.eventCallback(Events.START_CAST);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
this.player.addEventHandler(this.player.EVENT.ON_CAST_STOP, () => {
|
|
45
|
-
this.eventCallback(Events.END_CAST);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
this.player.addEventHandler(this.player.EVENT.ON_PLAY, () => {
|
|
49
|
-
this.eventCallback(Events.PLAY, {
|
|
50
|
-
currentTime : this.player.getCurrentTime(),
|
|
51
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
this.player.addEventHandler(this.player.EVENT.ON_PAUSE, () => {
|
|
56
|
-
this.eventCallback(Events.PAUSE, {
|
|
57
|
-
currentTime : this.player.getCurrentTime(),
|
|
58
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this.player.addEventHandler(this.player.EVENT.ON_TIME_CHANGED, () => {
|
|
63
|
-
this.eventCallback(Events.TIMECHANGED, {
|
|
64
|
-
currentTime : this.player.getCurrentTime(),
|
|
65
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
this.player.addEventHandler(this.player.EVENT.ON_SEEK, () => {
|
|
70
|
-
this.eventCallback(Events.SEEK, {
|
|
71
|
-
currentTime : this.player.getCurrentTime(),
|
|
72
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
this.player.addEventHandler(this.player.EVENT.ON_SEEKED, () => {
|
|
77
|
-
this.eventCallback(Events.SEEKED, {
|
|
78
|
-
currentTime : this.player.getCurrentTime(),
|
|
79
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
this.player.addEventHandler(this.player.EVENT.ON_START_BUFFERING, () => {
|
|
84
|
-
this.eventCallback(Events.START_BUFFERING);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
this.player.addEventHandler(this.player.EVENT.ON_STOP_BUFFERING, () => {
|
|
88
|
-
this.eventCallback(Events.END_BUFFERING, {
|
|
89
|
-
currentTime : this.player.getCurrentTime(),
|
|
90
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
this.player.addEventHandler(this.player.EVENT.ON_AUDIO_PLAYBACK_QUALITY_CHANGE, () => {
|
|
95
|
-
const quality = this.player.getPlaybackAudioData();
|
|
96
|
-
|
|
97
|
-
this.eventCallback(Events.AUDIO_CHANGE, {
|
|
98
|
-
bitrate : quality.bitrate,
|
|
99
|
-
currentTime : this.player.getCurrentTime(),
|
|
100
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
this.player.addEventHandler(this.player.EVENT.ON_VIDEO_PLAYBACK_QUALITY_CHANGE, () => {
|
|
105
|
-
const quality = this.player.getPlaybackVideoData();
|
|
106
|
-
|
|
107
|
-
this.eventCallback(Events.VIDEO_CHANGE, {
|
|
108
|
-
width : quality.width,
|
|
109
|
-
height : quality.height,
|
|
110
|
-
bitrate : quality.bitrate,
|
|
111
|
-
currentTime : this.player.getCurrentTime(),
|
|
112
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_ENTER, () => {
|
|
117
|
-
this.eventCallback(Events.START_FULLSCREEN, {
|
|
118
|
-
currentTime : this.player.getCurrentTime(),
|
|
119
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
this.onBeforeUnLoadEvent = false;
|
|
123
|
-
|
|
124
|
-
this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_EXIT, () => {
|
|
125
|
-
this.eventCallback(Events.END_FULLSCREEN, {
|
|
126
|
-
currentTime : this.player.getCurrentTime(),
|
|
127
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
this.player.addEventHandler(this.player.EVENT.ON_AD_STARTED, () => {
|
|
132
|
-
this.eventCallback(Events.START_AD, {
|
|
133
|
-
currentTime : this.player.getCurrentTime(),
|
|
134
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
this.player.addEventHandler(this.player.EVENT.ON_AD_FINISHED, () => {
|
|
139
|
-
this.eventCallback(Events.END_AD, {
|
|
140
|
-
currentTime : this.player.getCurrentTime(),
|
|
141
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
this.player.addEventHandler(this.player.EVENT.ON_MUTE, () => {
|
|
146
|
-
this.eventCallback(Events.MUTE, {
|
|
147
|
-
currentTime : this.player.getCurrentTime(),
|
|
148
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
this.player.addEventHandler(this.player.EVENT.ON_UNMUTE, () => {
|
|
153
|
-
this.eventCallback(Events.UN_MUTE, {
|
|
154
|
-
currentTime : this.player.getCurrentTime(),
|
|
155
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
this.player.addEventHandler(this.player.EVENT.ON_ERROR, (event) => {
|
|
160
|
-
this.eventCallback(Events.ERROR, {
|
|
161
|
-
code : event.code,
|
|
162
|
-
message: event.message
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
this.player.addEventHandler(this.player.EVENT.ON_PLAYBACK_FINISHED, () => {
|
|
167
|
-
this.eventCallback(Events.PLAYBACK_FINISHED, {
|
|
168
|
-
currentTime : this.player.getCurrentTime(),
|
|
169
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
if (typeof window !== "undefined")
|
|
174
|
-
{
|
|
175
|
-
window.onunload = window.onbeforeunload = () => {
|
|
176
|
-
if (!this.onBeforeUnLoadEvent) {
|
|
177
|
-
this.onBeforeUnLoadEvent = true;
|
|
178
|
-
this.eventCallback(Events.UNLOAD, {
|
|
179
|
-
currentTime : this.player.getCurrentTime(),
|
|
180
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
else{
|
|
186
|
-
if (!this.onBeforeUnLoadEvent) {
|
|
187
|
-
this.onBeforeUnLoadEvent = true;
|
|
188
|
-
this.eventCallback(Events.UNLOAD, {
|
|
189
|
-
currentTime : this.player.getCurrentTime(),
|
|
190
|
-
droppedFrames: this.player.getDroppedFrames()
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export default BitmovinAdapter;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/* global dashjs */
|
|
2
|
-
|
|
3
|
-
import {HTML5Adapter} from './HTML5Adapter';
|
|
4
|
-
import {MIMETypes} from '../enums/MIMETypes';
|
|
5
|
-
import {Players} from '../enums/Players';
|
|
6
|
-
import Events from '../enums/Events';
|
|
7
|
-
|
|
8
|
-
export class DashjsAdapter extends HTML5Adapter {
|
|
9
|
-
|
|
10
|
-
constructor(mediaPlayer, eventCallback, stateMachine) {
|
|
11
|
-
super(null, eventCallback, stateMachine, Players.DASHJS);
|
|
12
|
-
|
|
13
|
-
let videoEl = null;
|
|
14
|
-
let canPlay = false;
|
|
15
|
-
|
|
16
|
-
this.playerSoftwareName = Players.DASHJS;
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
videoEl = mediaPlayer.getVideoElement();
|
|
20
|
-
} catch(e) { /* eslint-disable-line no-empty */ }
|
|
21
|
-
if (!videoEl) {
|
|
22
|
-
mediaPlayer.on(dashjs.MediaPlayer.events.CAN_PLAY, () => {
|
|
23
|
-
if (canPlay) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
// console.log(dashjs.MediaPlayer.events.CAN_PLAY);
|
|
27
|
-
videoEl = mediaPlayer.getVideoElement();
|
|
28
|
-
canPlay = true;
|
|
29
|
-
this._initialize(mediaPlayer, videoEl);
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
duration,
|
|
33
|
-
autoplay,
|
|
34
|
-
videoWidth,
|
|
35
|
-
videoHeight,
|
|
36
|
-
muted
|
|
37
|
-
} = videoEl;
|
|
38
|
-
|
|
39
|
-
const width = videoEl.clientWidth;
|
|
40
|
-
const height = videoEl.clientHeight;
|
|
41
|
-
|
|
42
|
-
const info = {
|
|
43
|
-
type : 'html5',
|
|
44
|
-
isLive : this.isLive(),
|
|
45
|
-
version : this.getPlayerVersion() || 'html5',
|
|
46
|
-
streamType : this.getStreamType(),
|
|
47
|
-
streamUrl : this.getStreamURL(),
|
|
48
|
-
duration : duration,
|
|
49
|
-
autoplay : autoplay,
|
|
50
|
-
playerSoftware : this.playerSoftwareName,
|
|
51
|
-
videoWindowWidth : parseInt(width),
|
|
52
|
-
videoWindowHeight: parseInt(height),
|
|
53
|
-
currentVideoData:{
|
|
54
|
-
height : videoHeight,
|
|
55
|
-
width : videoWidth,
|
|
56
|
-
bitrate : this.analyticsBitrate_,
|
|
57
|
-
audioCodec : this.audioCodec_,
|
|
58
|
-
videoCodec : this.videoCodec_,
|
|
59
|
-
},
|
|
60
|
-
muted
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
this.eventCallback(Events.SOURCE_LOADED, info);
|
|
64
|
-
|
|
65
|
-
}, this);
|
|
66
|
-
} else {
|
|
67
|
-
this._initialize(mediaPlayer, videoEl);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_initialize(mediaPlayer, videoEl) {
|
|
72
|
-
/**
|
|
73
|
-
* @public
|
|
74
|
-
* @member {dashjs.MediaPlayer}
|
|
75
|
-
*/
|
|
76
|
-
this.mediaPlayer = mediaPlayer;
|
|
77
|
-
|
|
78
|
-
this.setMediaElement(videoEl);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getPlayerVersion() {
|
|
82
|
-
return this.mediaPlayer.getVersion();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
isLive() {
|
|
86
|
-
// FIXME: Maybe use http://cdn.dashjs.org/latest/jsdoc/module-MediaPlayer.html#getLiveDelay__anchor
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @override
|
|
92
|
-
*/
|
|
93
|
-
getMIMEType() {
|
|
94
|
-
return MIMETypes.DASH;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @override
|
|
99
|
-
*/
|
|
100
|
-
getStreamURL() {
|
|
101
|
-
return this.mediaPlayer ? this.mediaPlayer.getSource() : null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Implemented by sub-class to deliver current quality-level info
|
|
106
|
-
* specific to media-engine.
|
|
107
|
-
* @override
|
|
108
|
-
* @returns {QualityLevelInfo}
|
|
109
|
-
*/
|
|
110
|
-
getCurrentQualityLevelInfo() {
|
|
111
|
-
if (this.mediaPlayer) {
|
|
112
|
-
const videoBitrateInfoList = this.mediaPlayer.getBitrateInfoListFor('video');
|
|
113
|
-
const currentVideoQualityIndex = this.mediaPlayer.getQualityFor('video');
|
|
114
|
-
const currentVideoQuality = videoBitrateInfoList[currentVideoQualityIndex];
|
|
115
|
-
const currentVideoTrack = this.mediaPlayer.getCurrentTrackFor('video');
|
|
116
|
-
const currentAudioTrack = this.mediaPlayer.getCurrentTrackFor('audio');
|
|
117
|
-
|
|
118
|
-
const {width, height, bitrate} = currentVideoQuality;
|
|
119
|
-
let audioCodec = null;
|
|
120
|
-
let videoCodec = null;
|
|
121
|
-
|
|
122
|
-
if (currentVideoTrack) {
|
|
123
|
-
videoCodec = currentVideoTrack.codec.split('"').length > 0 ? currentVideoTrack.codec.split('"')[1] : currentVideoTrack.codec;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (currentAudioTrack) {
|
|
127
|
-
audioCodec = currentAudioTrack.codec.split('"').length > 0 ? currentAudioTrack.codec.split('"')[1] : currentAudioTrack.codec;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
width,
|
|
132
|
-
height,
|
|
133
|
-
bitrate,
|
|
134
|
-
audioCodec,
|
|
135
|
-
videoCodec,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
}
|