@latest-thinking/lt-player 1.0.4 → 1.0.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/dist/css/lt-player-main.css +1 -3
- package/dist/css/lt-player-main.css.map +1 -1
- package/dist/js/lt-player-main.js +1 -1
- package/dist/js/lt-player-main.js.map +1 -1
- package/package.json +10 -8
- package/src/assets/sass/app.scss +2 -2
- package/src/assets/sass/core/_fonts.scss +5 -5
- package/src/assets/sass/sections/_control.scss +35 -0
- package/src/assets/sass/sections/_poster.scss +3 -0
- package/src/assets/sass/sections/_settings.scss +1 -1
- package/src/assets/sass/sections/_subtitles.scss +4 -0
- package/src/assets/sass/sections/controllers/_botom.scss +15 -5
- package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +70 -11
- package/src/components/LTPlayerManager.ts +12 -5
- package/src/components/LTPlayerSetup.ts +31 -7
- package/src/components/LTPlayerType.ts +11 -7
- package/src/components/addInfo/LTPlayerAdditionalInfoEvents.ts +6 -2
- package/src/components/config/LTPlayerConfig.ts +192 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +546 -0
- package/src/components/controls/LTPlayerChapters.ts +8 -4
- package/src/components/controls/LTPlayerControls.ts +1 -1
- package/src/components/controls/LTPlayerControlsEvents.ts +206 -65
- package/src/components/controls/settings/LTPlayerDesktopSettingsControllers.ts +2 -4
- package/src/components/controls/settings/LTPlayerMobileSettingsControllers.ts +2 -0
- package/src/components/events/LTPlayer.ts +36 -1
- package/src/components/events/LTPlayerDesktop.ts +1 -0
- package/src/components/events/LTPlayerMobile.ts +1 -1
- package/src/components/poster/LTPlayerPoster.ts +2 -2
- package/src/components/poster/LTPlayerPosterEvents.ts +2 -0
- package/src/components/poster/LTPlayerPosterManager.ts +1 -1
- package/src/components/poster/LTPlayerPosterPreload.ts +1 -1
- package/src/components/poster/LTPlayerPosterPreloadEvents.ts +17 -6
- package/src/components/share/LTPlayerShare.ts +1 -1
- package/src/components/share/LTPlayerShareEvents.ts +20 -20
- package/src/global/controllers/LTPlayerController.ts +1 -1
- package/src/services/Helper.ts +20 -5
- package/src/services/IconsService.ts +15 -0
- package/src/services/LTPlayerRotateDeviceService.ts +8 -1
- package/src/services/ResizeService.ts +24 -6
- package/src/services/TemplateService.ts +1 -1
- package/src/views/controls.handlebars +71 -14
- package/src/views/settings.handlebars +3 -3
- package/src/views/template.handlebars +2 -2
- package/src/components/LTPlayerConfig.ts +0 -398
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {playerConfigType} from "../../global/types/ModuleTypes";
|
|
2
|
+
import {LTPlayerConfigProcessor} from "./LTPlayerConfigProcessor";
|
|
3
|
+
export class LTPlayerConfig {
|
|
4
|
+
|
|
5
|
+
private configData: playerConfigType = {
|
|
6
|
+
version : null,
|
|
7
|
+
preload: false,
|
|
8
|
+
autoPlay : false,
|
|
9
|
+
videoTitle: '',
|
|
10
|
+
posterImage: '',
|
|
11
|
+
videoParagraph: '',
|
|
12
|
+
videoUrl : false,
|
|
13
|
+
playerId: '',
|
|
14
|
+
playerContainer: '',
|
|
15
|
+
vimeo: false,
|
|
16
|
+
youtube: {
|
|
17
|
+
'controls': 0,
|
|
18
|
+
'noCookie': false,
|
|
19
|
+
'rel': 0,
|
|
20
|
+
'showinfo': 0,
|
|
21
|
+
'iv_load_policy': 3,
|
|
22
|
+
'modestbranding': 1,
|
|
23
|
+
'playsinline': true,
|
|
24
|
+
},
|
|
25
|
+
defaultConfig : false,
|
|
26
|
+
share: null,
|
|
27
|
+
chapters : null,
|
|
28
|
+
playerType: null,
|
|
29
|
+
device : 'desktop',
|
|
30
|
+
observe : false
|
|
31
|
+
}
|
|
32
|
+
processor : LTPlayerConfigProcessor.Map
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param version
|
|
37
|
+
*/
|
|
38
|
+
constructor(version: string | number) {
|
|
39
|
+
this.processor = new LTPlayerConfigProcessor.Map();
|
|
40
|
+
this.setVersion(version);
|
|
41
|
+
this.processor.setVersion(this.configData.version);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
mapConfigData(config : playerConfigType) {
|
|
45
|
+
|
|
46
|
+
Object.keys(this.configData).forEach(instanceItem => {
|
|
47
|
+
|
|
48
|
+
if (this.processor.version === 1) {
|
|
49
|
+
let process = this.processor.processItem(instanceItem, config);
|
|
50
|
+
|
|
51
|
+
if (process) {
|
|
52
|
+
this.configData[instanceItem] = process;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
let process = this.processor.processItem(instanceItem, (config[instanceItem]) ?? null);
|
|
56
|
+
|
|
57
|
+
if (process) {
|
|
58
|
+
this.configData[instanceItem] = process;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setVersion(version : string | number) {
|
|
65
|
+
|
|
66
|
+
if (typeof version === 'string') {
|
|
67
|
+
return this.configData.version = parseInt(version);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.configData.version = version;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getVersion() {
|
|
74
|
+
return this.configData.version
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getObserve() {
|
|
78
|
+
return this.configData.observe
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getDimensions() {
|
|
82
|
+
return this.configData.dimensions
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getAdditionalInfo() {
|
|
86
|
+
return this.configData.additionalInfo;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getVideoTitle() {
|
|
90
|
+
return this.configData.videoTitle;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getPosterImage() {
|
|
94
|
+
return this.configData.posterImage;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getParagraph() {
|
|
98
|
+
return this.configData.videoParagraph;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getVideoType() {
|
|
102
|
+
return this.configData.videoUrl.videoType;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
getVideoUrl() {
|
|
106
|
+
return this.configData.videoUrl;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getPlayerId() {
|
|
110
|
+
return this.configData.playerId;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getConfigData() {
|
|
114
|
+
return this.configData;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
getPlayerElementContainer() {
|
|
118
|
+
return this.configData.playerContainer;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getVideoOrigin() {
|
|
122
|
+
return this.configData.videoUrl.origin;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
* @param origin
|
|
128
|
+
*/
|
|
129
|
+
getConfigByOrigin(origin: string) {
|
|
130
|
+
return (this.configData[origin] !== undefined) ? this.configData[origin] : null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
getDefaultConfigItems() {
|
|
134
|
+
return this.configData.defaultConfig;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
getChapters() {
|
|
138
|
+
return this.configData.chapters
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
isShareData() {
|
|
142
|
+
if (this.configData.share) {
|
|
143
|
+
return Object.keys(this.configData.share).length > 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
getShareData() {
|
|
150
|
+
return this.configData.share
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
getCaptions () {
|
|
154
|
+
return this.configData.defaultConfig.captions
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
getPlayerType() {
|
|
158
|
+
return this.configData.playerType
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
setPlayerId(id: number) {
|
|
162
|
+
this.configData.playerId = id;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
isAutoPlay() {
|
|
166
|
+
return this.configData.autoPlay;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
getPreload() {
|
|
170
|
+
return this.configData.preload;
|
|
171
|
+
}
|
|
172
|
+
isAutoPreload() {
|
|
173
|
+
return this.configData.preload.autoType;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
getDevice() {
|
|
177
|
+
return this.configData.device;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
getEmbedOrigin() {
|
|
181
|
+
return {[this.getVideoOrigin()] : this.getConfigByOrigin(this.getVideoOrigin())};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getFullscreenMode() {
|
|
185
|
+
if (this.getDevice() === 'mobile') {
|
|
186
|
+
return {fullscreen: {enabled: false}}
|
|
187
|
+
} else {
|
|
188
|
+
return false
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|