@latest-thinking/lt-player 1.0.4 → 1.0.5-b

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.
Files changed (48) hide show
  1. package/dist/css/lt-player-main.css +1 -3
  2. package/dist/css/lt-player-main.css.map +1 -1
  3. package/dist/js/lt-player-main.js +1 -1
  4. package/dist/js/lt-player-main.js.map +1 -1
  5. package/package.json +10 -8
  6. package/src/assets/sass/app.scss +2 -2
  7. package/src/assets/sass/core/_fonts.scss +5 -5
  8. package/src/assets/sass/sections/_control.scss +35 -0
  9. package/src/assets/sass/sections/_poster.scss +3 -0
  10. package/src/assets/sass/sections/_settings.scss +1 -1
  11. package/src/assets/sass/sections/_subtitles.scss +4 -0
  12. package/src/assets/sass/sections/controllers/_botom.scss +15 -5
  13. package/src/assets/sass/sections/controllers/_mini-player.scss +17 -2
  14. package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +70 -11
  15. package/src/components/LTPlayerDevMethode.ts +23 -3
  16. package/src/components/LTPlayerManager.ts +12 -5
  17. package/src/components/LTPlayerSetup.ts +31 -7
  18. package/src/components/LTPlayerType.ts +58 -11
  19. package/src/components/addInfo/LTPlayerAdditionalInfoEvents.ts +6 -2
  20. package/src/components/config/LTPlayerConfig.ts +200 -0
  21. package/src/components/config/LTPlayerConfigProcessor.ts +546 -0
  22. package/src/components/controls/LTPlayerChapters.ts +8 -4
  23. package/src/components/controls/LTPlayerControls.ts +1 -1
  24. package/src/components/controls/LTPlayerControlsEvents.ts +225 -71
  25. package/src/components/controls/LTPlayerMini.ts +75 -5
  26. package/src/components/controls/settings/LTPlayerDesktopSettingsControllers.ts +2 -4
  27. package/src/components/controls/settings/LTPlayerMobileSettingsControllers.ts +2 -0
  28. package/src/components/events/LTPlayer.ts +46 -2
  29. package/src/components/events/LTPlayerDesktop.ts +1 -0
  30. package/src/components/events/LTPlayerMobile.ts +1 -1
  31. package/src/components/poster/LTPlayerPoster.ts +2 -2
  32. package/src/components/poster/LTPlayerPosterEvents.ts +5 -0
  33. package/src/components/poster/LTPlayerPosterManager.ts +1 -1
  34. package/src/components/poster/LTPlayerPosterPreload.ts +1 -1
  35. package/src/components/poster/LTPlayerPosterPreloadEvents.ts +17 -6
  36. package/src/components/share/LTPlayerShare.ts +1 -1
  37. package/src/components/share/LTPlayerShareEvents.ts +20 -20
  38. package/src/global/controllers/LTPlayerController.ts +1 -1
  39. package/src/services/Helper.ts +20 -5
  40. package/src/services/IconsService.ts +15 -0
  41. package/src/services/LTPlayerRotateDeviceService.ts +8 -1
  42. package/src/services/ResizeService.ts +24 -6
  43. package/src/services/TemplateService.ts +1 -1
  44. package/src/views/background.handlebars +1 -1
  45. package/src/views/controls.handlebars +71 -14
  46. package/src/views/settings.handlebars +3 -3
  47. package/src/views/template.handlebars +2 -2
  48. package/src/components/LTPlayerConfig.ts +0 -398
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@latest-thinking/lt-player",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-b",
4
4
  "description": "LT player.",
5
- "main": "dist/js/lt-player-app.js",
6
- "module": "dist/js/lt-player-app.js",
5
+ "main": "dist/js/lt-player-main.js",
6
+ "module": "dist/js/lt-player-main.js",
7
7
  "sass": "src/assets/sass/app.scss",
8
- "style": "dist/css/lt-player-app.css",
8
+ "style": "dist/css/lt-player-main.css",
9
9
  "scripts": {
10
10
  "lint": "npm run lint:styles; npm run lint:scripts",
11
11
  "lint:styles": "stylelint src",
@@ -29,7 +29,6 @@
29
29
  "css-loader": "^6.7.2",
30
30
  "eslint": "^8.7.0",
31
31
  "eslint-webpack-plugin": "^3.1.1",
32
- "file-loader": "^6.2.0",
33
32
  "fixed": "^0.3.1",
34
33
  "hammerjs": "^2.0.8",
35
34
  "handlebars": "^4.7.7",
@@ -42,13 +41,12 @@
42
41
  "postcss-preset-env": "^7.2.3",
43
42
  "rangetouch": "^2.0.1",
44
43
  "raw-loader": "^4.0.2",
45
- "sass-loader": "^12.4.0",
44
+ "resolve-url-loader": "^5.0.0",
46
45
  "stylelint": "^14.2.0",
47
46
  "stylelint-config-standard": "^24.0.0",
48
47
  "stylelint-webpack-plugin": "^3.1.1",
49
48
  "ts-loader": "^9.4.1",
50
49
  "typescript": "^4.9.3",
51
- "webpack": "^5.66.0",
52
50
  "webpack-cli": "^4.9.1",
53
51
  "webpack-dev-server": "^4.7.3",
54
52
  "webpack-merge": "^5.8.0"
@@ -59,6 +57,10 @@
59
57
  "@typescript-eslint/parser": "^5.48.0",
60
58
  "dotenv-webpack": "^8.0.1",
61
59
  "eslint": "^8.31.0",
62
- "eslint-webpack-plugin": "^3.1.1"
60
+ "eslint-webpack-plugin": "^3.1.1",
61
+ "sass": "^1.60.0",
62
+ "sass-loader": "^13.2.2",
63
+ "webpack": "^5.76.3",
64
+ "plyr": "^3.7.3"
63
65
  }
64
66
  }
@@ -52,8 +52,8 @@
52
52
  // 5. Additional imports
53
53
  //---------------------------------------------
54
54
 
55
- @import "~plyr/dist/plyr.css";
55
+ @import "~plyr";
56
56
 
57
57
  :root {
58
58
  --plyr-color-main: $default_color_player;
59
- }
59
+ }
@@ -22,31 +22,31 @@
22
22
 
23
23
  @font-face {
24
24
  font-family: "MuseoSans";
25
- src: url('../fonts/museo/MuseoSans-100.otf') format('opentype');
25
+ src: url('../../fonts/museo/MuseoSans-100.otf') format('opentype');
26
26
  font-weight: 100;
27
27
  }
28
28
 
29
29
  @font-face {
30
30
  font-family: "MuseoSans";
31
- src: url('../fonts/museo/MuseoSans-300.otf') format('opentype');
31
+ src: url('../../fonts/museo/MuseoSans-300.otf') format('opentype');
32
32
  font-weight: 300;
33
33
  }
34
34
 
35
35
  @font-face {
36
36
  font-family: "MuseoSans";
37
- src: url('../fonts/museo/MuseoSans-500.otf') format('opentype');
37
+ src: url('../../fonts/museo/MuseoSans-500.otf') format('opentype');
38
38
  font-weight: 500;
39
39
  }
40
40
 
41
41
  @font-face {
42
42
  font-family: "MuseoSans";
43
- src: url('../fonts/museo/MuseoSans-700.otf') format('opentype');
43
+ src: url('../../fonts/museo/MuseoSans-700.otf') format('opentype');
44
44
  font-weight: 700;
45
45
  }
46
46
 
47
47
  @font-face {
48
48
  font-family: "MuseoSans";
49
- src: url('../fonts/museo/MuseoSans-900.otf') format('opentype');
49
+ src: url('../../fonts/museo/MuseoSans-900.otf') format('opentype');
50
50
  font-weight: 900;
51
51
  }
52
52
 
@@ -13,6 +13,8 @@
13
13
 
14
14
  .plyr {
15
15
  .plyr--video, &__controls {
16
+ touch-action: none!important;
17
+ pointer-events: auto!important;
16
18
  opacity: 0;
17
19
  height: 100%;
18
20
  width: 100%;
@@ -25,6 +27,39 @@
25
27
  }
26
28
 
27
29
  &__controls {
30
+
31
+ touch-action: inherit!important;
32
+
33
+ &__mobile-background {
34
+ touch-action: inherit!important;
35
+ position: absolute;
36
+ width: 100%;
37
+ height: 100%;
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
+
61
+ }
62
+
28
63
  &__shortcut-area {
29
64
 
30
65
  }
@@ -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
 
@@ -345,7 +345,7 @@
345
345
  top: 0;
346
346
  background: #27282A;
347
347
  opacity: 0.75;
348
- z-index: 5;
348
+ z-index: 10;
349
349
  }
350
350
  }
351
351
  }
@@ -11,3 +11,7 @@
11
11
  font-family: $lt-font-family-base !important;
12
12
  white-space: unset !important;
13
13
  }
14
+
15
+ .plyr__captions span:empty {
16
+ display: none!important;
17
+ }
@@ -80,7 +80,7 @@
80
80
  .bottom-controller {
81
81
  .play-button {
82
82
  padding: .75rem;
83
- bottom: 0;
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: 0;
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: 0;
132
+ bottom: -2px;
133
133
  }
134
134
 
135
135
  .plyr__controls_speed-button {
@@ -251,10 +251,14 @@
251
251
  white-space: nowrap;
252
252
  font-size: 12px;
253
253
  transition: none;
254
+ outline: none;
254
255
  background-color: $default-lt-player-blue;
255
256
 
256
257
  &:focus,
257
- &:active {
258
+ &:active,
259
+ &:hover,
260
+ &:focus-visible {
261
+ outline: $default-lt-player-blue;
258
262
  background-color: $default-lt-player-blue;
259
263
  }
260
264
  }
@@ -269,9 +273,12 @@
269
273
  }
270
274
 
271
275
  &__play-button_body {
272
- bottom: -8px;
273
276
  position: relative;
274
277
 
278
+ &__portrait {
279
+ bottom: -8px;
280
+ }
281
+
275
282
  .play-button {
276
283
  @extend %lt-player-btn;
277
284
  @include yellow-btn;
@@ -309,6 +316,9 @@
309
316
  position: absolute;
310
317
  rotate: 270deg!important;
311
318
  bottom: 5rem;
319
+ max-width: 110px;
320
+ min-width: 80px;
321
+ width: 20%;
312
322
 
313
323
  .volume_control__background__area__range {
314
324
  color: $default-lt-button-color !important;
@@ -3,11 +3,16 @@
3
3
  width: 100%;
4
4
  height: 100%;
5
5
  }
6
+
7
+ .lt-player-mini-player-observe {
8
+ min-height: 200px;
9
+ max-height: 600px;
10
+ height: auto;
11
+ }
12
+
6
13
  .lt-player-mini-enable {
7
14
  position: fixed;
8
15
  z-index: 10000;
9
- max-width: 160px;
10
- max-height: 290px;
11
16
  bottom: 20px;
12
17
  right: 20px;
13
18
  opacity: 1;
@@ -19,6 +24,16 @@
19
24
  }
20
25
  }
21
26
 
27
+ .lt-player-mini-2 {
28
+ max-width: 344px;
29
+ max-height: 194px;
30
+ }
31
+
32
+ .lt-player-mini-1 {
33
+ max-width: 160px;
34
+ max-height: 290px;
35
+ }
36
+
22
37
  .lt-player-mini-player-background {
23
38
  z-index: 100;
24
39
 
@@ -12,7 +12,10 @@
12
12
  }
13
13
 
14
14
  .poster-paragraph {
15
- font-size: .9rem;
15
+ &__content {
16
+ font-size: .9rem;
17
+ }
18
+
16
19
  }
17
20
  }
18
21
  }
@@ -44,7 +47,7 @@
44
47
 
45
48
  .player-state {
46
49
  opacity: 0;
47
- transition: all 0.3s ease-in-out;
50
+ transition: all 0.8s ease-in-out;
48
51
  pointer-events: none;
49
52
  @extend %lt-player-btn;
50
53
  @include dark-btn;
@@ -54,7 +57,7 @@
54
57
 
55
58
  .active {
56
59
  opacity: 1;
57
- transition: all 0.3s ease-in-out;
60
+ transition: all 0.2s ease-in-out;
58
61
  }
59
62
  }
60
63
 
@@ -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,14 +87,50 @@
83
87
  }
84
88
 
85
89
  .poster-paragraph {
86
- font-weight: $lt-player-font-weight-sm;
87
- color: $default-lt-player-white !important;
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
 
93
132
  .lt-player-rewind-area {
133
+ touch-action: inherit!important;
94
134
  width: 100%;
95
135
  height: 100%;
96
136
  z-index: 3;
@@ -98,14 +138,15 @@
98
138
 
99
139
  .lt-player-rewind {
100
140
  width: 50%;
101
- height: 100%;
141
+ height: 130%;
142
+ top: -10rem;
102
143
  display:flex;
103
144
  flex-direction: row;
104
145
  position: absolute;
105
146
  text-align: center;
106
147
  border-radius:0 100% 100% 0;
107
148
  left: 0;
108
- top: 0;
149
+
109
150
 
110
151
  &__icon-wrapper {
111
152
  display: flex;
@@ -125,9 +166,17 @@
125
166
  display: flex;
126
167
  justify-content:flex-start;
127
168
  align-items:center;
128
- margin: auto;
169
+
129
170
  color: rgba(255,255,255, 1);
130
171
  user-select: none;
172
+
173
+ &__portrait {
174
+ margin: auto auto 18rem 3rem;
175
+ }
176
+
177
+ &__landscape {
178
+ margin: auto auto 13rem 4rem;
179
+ }
131
180
  }
132
181
 
133
182
  span {
@@ -138,6 +187,7 @@
138
187
  }
139
188
 
140
189
  .lt-player-forward-area {
190
+ touch-action: inherit!important;
141
191
  width: 100%;
142
192
  height: 100%;
143
193
  z-index: 4;
@@ -145,14 +195,14 @@
145
195
 
146
196
  .lt-player-forward {
147
197
  width: 50%;
148
- height: 100%;
198
+ height: 130%;
199
+ top: -10rem;
149
200
  display:flex;
150
201
  flex-direction: row;
151
202
  position: absolute;
152
203
  text-align: center;
153
204
  border-radius:100% 0 0 100%;
154
205
  right: 0;
155
- top: 0;
156
206
 
157
207
  &__icon-wrapper {
158
208
  display: flex;
@@ -171,8 +221,17 @@
171
221
  display: flex;
172
222
  justify-content:flex-start;
173
223
  align-items:center;
174
- margin: auto;
224
+
175
225
  color: rgba(255,255,255, 1);
226
+
227
+ &__portrait {
228
+ margin: auto 3rem 18rem auto;
229
+ }
230
+
231
+ &__landscape {
232
+ margin: auto 4rem 13rem auto;
233
+ }
234
+
176
235
  }
177
236
 
178
237
  span{
@@ -8,9 +8,11 @@ export namespace LTPlayerDevMethode {
8
8
  export class Player {
9
9
 
10
10
  player: Plyr
11
+ instance : LTPlayer.PortraitType | LTPlayer.LandscapeType
11
12
 
12
- constructor(player: Plyr) {
13
- this.player = player;
13
+ constructor(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
14
+ this.player = instance.plyr;
15
+ this.instance = instance
14
16
  }
15
17
 
16
18
  play() {
@@ -77,7 +79,9 @@ export namespace LTPlayerDevMethode {
77
79
  let miniPlayer = {
78
80
  controls : playerContainer.querySelector('.lt-player-mini-player-controls'),
79
81
  background: playerContainer.querySelector('.lt-player-mini-player-background'),
80
- enable: playerContainer.querySelector('.lt-player-mini-enable')
82
+ enable: playerContainer.querySelector('.lt-player-mini-enable'),
83
+ size_land: playerContainer.querySelector(`.lt-player-mini-1`),
84
+ size_port: playerContainer.querySelector(`.lt-player-mini-2`)
81
85
  };
82
86
 
83
87
  if (miniPlayer.controls) {
@@ -88,6 +92,14 @@ export namespace LTPlayerDevMethode {
88
92
  miniPlayer.background.remove();
89
93
  }
90
94
 
95
+ if (miniPlayer.size_land) {
96
+ miniPlayer.size_land.classList.remove(`lt-player-mini-1`)
97
+ }
98
+
99
+ if (miniPlayer.size_port) {
100
+ miniPlayer.size_port.classList.remove(`lt-player-mini-2`)
101
+ }
102
+
91
103
  if (miniPlayer.enable) {
92
104
  miniPlayer.enable.classList.remove('lt-player-mini-enable')
93
105
  }
@@ -106,6 +118,14 @@ export namespace LTPlayerDevMethode {
106
118
  exitFullScreen();
107
119
 
108
120
  }
121
+
122
+ enterMiniPlayer() {
123
+ this.instance.miniPlayer.enterMiniPlayer();
124
+ }
125
+
126
+ exitMiniPlayer() {
127
+ this.instance.miniPlayer.exitMiniPlayer(this.player);
128
+ }
109
129
  }
110
130
 
111
131
  export class Preload {
@@ -114,11 +114,18 @@ export class LTPlayerManager {
114
114
 
115
115
  const setup = new LTPlayerSetup();
116
116
 
117
- return new Promise(resolve => {
118
- setup.init(playerConfig).then( result => {
119
- this.players.push(result);
120
- resolve(result);
121
- })
117
+ return new Promise((resolve, reject) => {
118
+ let setupPLayer = setup.init(playerConfig);
119
+
120
+ if (setupPLayer) {
121
+ setupPLayer.then( result => {
122
+ this.players.push(result);
123
+ resolve(result);
124
+ })
125
+ } else {
126
+ reject('Player is not setup')
127
+ }
128
+
122
129
  })
123
130
 
124
131
 
@@ -64,17 +64,42 @@ export class LTPlayerSetup {
64
64
  console.info(`Set Additional Info`);
65
65
  }
66
66
 
67
- if (!playerConfig.body.playerType) {
68
- return new Promise(resolve => {
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
+
93
+ return new Promise((resolve, reject) => {
69
94
  playerConfig.body.playerType = this.getVideoTypeByUrl(playerConfig.body.videoUrl).then(response => {
70
95
  playerConfig.body.playerType = response;
71
- resolve(this.setType(playerConfig, playerContainer))
96
+ resolve(this.setType(playerConfig, playerContainer));
72
97
  });
73
98
  })
74
99
  } else {
75
-
76
- return new Promise(resolve => {
77
- resolve(this.setType(playerConfig, playerContainer))
100
+ return new Promise((resolve, reject) => {
101
+ resolve(this.setType(playerConfig, playerContainer));
102
+ reject(null);
78
103
  });
79
104
  }
80
105
  }
@@ -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) =>{