@latest-thinking/lt-player 1.0.4-n → 1.0.4-p
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 -1
- 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 +1 -1
- package/src/assets/sass/sections/_control.scss +22 -0
- package/src/assets/sass/sections/_poster.scss +3 -0
- package/src/assets/sass/sections/controllers/_botom.scss +3 -3
- package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +42 -3
- package/src/components/LTPlayerSetup.ts +26 -2
- package/src/components/LTPlayerType.ts +11 -7
- package/src/components/config/LTPlayerConfig.ts +184 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +496 -0
- package/src/components/controls/LTPlayerControls.ts +1 -1
- package/src/components/controls/LTPlayerControlsEvents.ts +92 -7
- package/src/components/poster/LTPlayerPoster.ts +1 -1
- 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/share/LTPlayerShare.ts +1 -1
- package/src/global/controllers/LTPlayerController.ts +1 -1
- package/src/services/Helper.ts +20 -5
- package/src/services/TemplateService.ts +1 -1
- package/src/views/controls.handlebars +56 -3
- package/src/views/template.handlebars +2 -2
- package/src/components/LTPlayerConfig.ts +0 -398
package/package.json
CHANGED
|
@@ -36,6 +36,28 @@
|
|
|
36
36
|
width: 100%;
|
|
37
37
|
height: 100%;
|
|
38
38
|
z-index: 9999;
|
|
39
|
+
|
|
40
|
+
.lt-player-notification {
|
|
41
|
+
.lt-player-rewind {
|
|
42
|
+
height: 100%;
|
|
43
|
+
top: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lt-player-rewind__icon__portrait {
|
|
47
|
+
margin: auto auto auto 2rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.lt-player-forward {
|
|
51
|
+
height: 100%;
|
|
52
|
+
top: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.lt-player-forward__icon__portrait {
|
|
56
|
+
margin: auto 2rem auto auto;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
&__shortcut-area {
|
|
@@ -117,6 +117,8 @@
|
|
|
117
117
|
display: flex;
|
|
118
118
|
flex-direction: column;
|
|
119
119
|
justify-content: space-between;
|
|
120
|
+
position: absolute;
|
|
121
|
+
bottom: 0;
|
|
120
122
|
|
|
121
123
|
&__header {
|
|
122
124
|
padding: 1.5rem;
|
|
@@ -157,6 +159,7 @@
|
|
|
157
159
|
font-size: $lt-player-font-size-xxl;
|
|
158
160
|
margin: 0;
|
|
159
161
|
color: $default-lt-player-white !important;
|
|
162
|
+
display: block;
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
.bottom-controller {
|
|
81
81
|
.play-button {
|
|
82
82
|
padding: .75rem;
|
|
83
|
-
bottom:
|
|
83
|
+
bottom: -2px;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&__center-buttons {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
.bottom-controller {
|
|
98
98
|
.play-button {
|
|
99
99
|
padding: .75rem;
|
|
100
|
-
bottom:
|
|
100
|
+
bottom: -2px;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
&__center-buttons {
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
|
|
130
130
|
.play-button {
|
|
131
131
|
padding: .75rem;
|
|
132
|
-
bottom:
|
|
132
|
+
bottom: -2px;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.plyr__controls_speed-button {
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.poster-paragraph {
|
|
15
|
-
|
|
15
|
+
&__content {
|
|
16
|
+
font-size: .9rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
.content__body {
|
|
71
74
|
z-index: 2;
|
|
72
75
|
margin-top: auto;
|
|
76
|
+
width: 100%;
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
.poster-title {
|
|
@@ -83,10 +87,45 @@
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
.poster-paragraph {
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
|
|
91
|
+
margin-bottom: 3rem;
|
|
92
|
+
|
|
93
|
+
&__content {
|
|
94
|
+
display: -webkit-box;
|
|
95
|
+
-webkit-line-clamp: 2;
|
|
96
|
+
-webkit-box-orient: vertical;
|
|
97
|
+
word-wrap: break-word;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
|
|
101
|
+
font-weight: $lt-player-font-weight-sm;
|
|
102
|
+
color: $default-lt-player-white !important;
|
|
103
|
+
margin-bottom: 0;
|
|
104
|
+
max-height: 3.1rem;
|
|
105
|
+
transition: max-height 0.3s ease-in-out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.open-content {
|
|
109
|
+
display: block;
|
|
110
|
+
transition: max-height 0.3s ease-in-out;
|
|
111
|
+
}
|
|
88
112
|
}
|
|
113
|
+
}
|
|
89
114
|
|
|
115
|
+
.poster-paragraph__button {
|
|
116
|
+
background: none;
|
|
117
|
+
box-shadow: none;
|
|
118
|
+
padding: 0;
|
|
119
|
+
border: none;
|
|
120
|
+
margin: 0;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
font-size: 0.8rem;
|
|
123
|
+
color: white;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
position: absolute;
|
|
126
|
+
bottom: 6rem;
|
|
127
|
+
right: 6rem;
|
|
128
|
+
z-index: 8;
|
|
90
129
|
}
|
|
91
130
|
|
|
92
131
|
|
|
@@ -64,7 +64,32 @@ export class LTPlayerSetup {
|
|
|
64
64
|
console.info(`Set Additional Info`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
if (
|
|
67
|
+
if (playerConfig.body.playerType === undefined) {
|
|
68
|
+
const checkVersion = (version : string | number) : boolean => {
|
|
69
|
+
if (typeof version === 'string') {
|
|
70
|
+
if (parseInt(version) === 1) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof version === "number") {
|
|
76
|
+
if (version === 1) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false;
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (checkVersion(playerConfig.version)) {
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
playerConfig.body.playerType = 2;
|
|
88
|
+
resolve(this.setType(playerConfig, playerContainer));
|
|
89
|
+
reject(null);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
68
93
|
return new Promise((resolve, reject) => {
|
|
69
94
|
playerConfig.body.playerType = this.getVideoTypeByUrl(playerConfig.body.videoUrl).then(response => {
|
|
70
95
|
playerConfig.body.playerType = response;
|
|
@@ -115,7 +140,6 @@ export class LTPlayerSetup {
|
|
|
115
140
|
|
|
116
141
|
let videoData = Helper.processConfigData(url) as urlVideoType;
|
|
117
142
|
|
|
118
|
-
|
|
119
143
|
const processEmbed = () => {
|
|
120
144
|
|
|
121
145
|
const embedRequest = (url: string) =>{
|
|
@@ -2,13 +2,14 @@ import {LTPlayerController} from "../global/controllers/LTPlayerController";
|
|
|
2
2
|
import {TypeInterface} from "../global/interfaces/TypeInterface";
|
|
3
3
|
import {defaultType, playerConfigType} from "../global/types/ModuleTypes";
|
|
4
4
|
import {LTPlayerMini} from "./controls/LTPlayerMini";
|
|
5
|
-
import {LTPlayerConfig} from "./LTPlayerConfig";
|
|
5
|
+
import {LTPlayerConfig} from "./config/LTPlayerConfig";
|
|
6
6
|
import Plyr from "plyr";
|
|
7
7
|
import {LTPlayerDevMethode} from "./LTPlayerDevMethode";
|
|
8
8
|
import {LTPlayerEventsManager} from "./LTPlayerEventsManager";
|
|
9
9
|
import {LTPLayerAddInfo} from "./addInfo/LTPlayerAddInfoManager";
|
|
10
10
|
import {LTPlayerEvents} from "./events/LTPlayer";
|
|
11
11
|
import {LTPlayerPosterManager} from "./poster/LTPlayerPosterManager";
|
|
12
|
+
import {config} from "json-schema-library";
|
|
12
13
|
|
|
13
14
|
export namespace LTPlayer {
|
|
14
15
|
|
|
@@ -37,7 +38,7 @@ export namespace LTPlayer {
|
|
|
37
38
|
|
|
38
39
|
this.additionalInfoService = additionalInfoService;
|
|
39
40
|
this.miniPlayer = new LTPlayerMini();
|
|
40
|
-
this.setPlayerConfig(configData.body);
|
|
41
|
+
this.setPlayerConfig(configData.body, configData.version);
|
|
41
42
|
this.initSetupPlayerPoster(configData.body);
|
|
42
43
|
this.initPlayer();
|
|
43
44
|
this.setEvents();
|
|
@@ -68,10 +69,12 @@ export namespace LTPlayer {
|
|
|
68
69
|
/**
|
|
69
70
|
* Set Player config Instance
|
|
70
71
|
* @param configData
|
|
72
|
+
* @param version
|
|
71
73
|
* @private
|
|
72
74
|
*/
|
|
73
|
-
private setPlayerConfig(configData: playerConfigType) {
|
|
74
|
-
this.playerConfig = new LTPlayerConfig(
|
|
75
|
+
private setPlayerConfig(configData: playerConfigType, version : string | number) {
|
|
76
|
+
this.playerConfig = new LTPlayerConfig(version);
|
|
77
|
+
this.playerConfig.mapConfigData(configData);
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
@@ -206,7 +209,7 @@ export namespace LTPlayer {
|
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
this.miniPlayer = new LTPlayerMini();
|
|
209
|
-
this.setPlayerConfig(configData.body);
|
|
212
|
+
this.setPlayerConfig(configData.body, configData.version);
|
|
210
213
|
this.initPoster(configData.body);
|
|
211
214
|
this.initPlayer();
|
|
212
215
|
this.setEvents();
|
|
@@ -283,8 +286,9 @@ export namespace LTPlayer {
|
|
|
283
286
|
playerContainer.insertAdjacentHTML("afterend", this.templateService.getOnloadPoster({logo: logo})) ;
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
private setPlayerConfig(configData: playerConfigType) {
|
|
287
|
-
this.playerConfig = new LTPlayerConfig(
|
|
289
|
+
private setPlayerConfig(configData: playerConfigType, version: string | number) {
|
|
290
|
+
this.playerConfig = new LTPlayerConfig(version);
|
|
291
|
+
this.playerConfig.mapConfigData(configData);
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
public getPlayer() {
|
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
}
|
|
31
|
+
processor : LTPlayerConfigProcessor.Map
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param version
|
|
36
|
+
*/
|
|
37
|
+
constructor(version: string | number) {
|
|
38
|
+
this.processor = new LTPlayerConfigProcessor.Map();
|
|
39
|
+
this.setVersion(version);
|
|
40
|
+
this.processor.setVersion(this.configData.version);
|
|
41
|
+
// this.processConfigData();
|
|
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
|
+
getDimensions() {
|
|
74
|
+
return this.configData.dimensions
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getAdditionalInfo() {
|
|
78
|
+
return this.configData.additionalInfo;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getVideoTitle() {
|
|
82
|
+
return this.configData.videoTitle;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getPosterImage() {
|
|
86
|
+
return this.configData.posterImage;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getParagraph() {
|
|
90
|
+
return this.configData.videoParagraph;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getVideoType() {
|
|
94
|
+
return this.configData.videoUrl.videoType;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getVideoUrl() {
|
|
98
|
+
return this.configData.videoUrl;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getPlayerId() {
|
|
102
|
+
return this.configData.playerId;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
getConfigData() {
|
|
106
|
+
return this.configData;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getPlayerElementContainer() {
|
|
110
|
+
return this.configData.playerContainer;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getVideoOrigin() {
|
|
114
|
+
return this.configData.videoUrl.origin;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param origin
|
|
120
|
+
*/
|
|
121
|
+
getConfigByOrigin(origin: string) {
|
|
122
|
+
return (this.configData[origin] !== undefined) ? this.configData[origin] : null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getDefaultConfigItems() {
|
|
126
|
+
return this.configData.defaultConfig;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
getChapters() {
|
|
130
|
+
return this.configData.chapters
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
isShareData() {
|
|
134
|
+
if (this.configData.share) {
|
|
135
|
+
return Object.keys(this.configData.share).length > 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getShareData() {
|
|
142
|
+
return this.configData.share
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
getCaptions () {
|
|
146
|
+
return this.configData.defaultConfig.captions
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
getPlayerType() {
|
|
150
|
+
return this.configData.playerType
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
setPlayerId(id: number) {
|
|
154
|
+
this.configData.playerId = id;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
isAutoPlay() {
|
|
158
|
+
return this.configData.autoPlay;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getPreload() {
|
|
162
|
+
return this.configData.preload;
|
|
163
|
+
}
|
|
164
|
+
isAutoPreload() {
|
|
165
|
+
return this.configData.preload.autoType;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getDevice() {
|
|
169
|
+
return this.configData.device;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getEmbedOrigin() {
|
|
173
|
+
return {[this.getVideoOrigin()] : this.getConfigByOrigin(this.getVideoOrigin())};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
getFullscreenMode() {
|
|
177
|
+
if (this.getDevice() === 'mobile') {
|
|
178
|
+
return {fullscreen: {enabled: false}}
|
|
179
|
+
} else {
|
|
180
|
+
return false
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|