@latest-thinking/lt-player 1.0.5-n → 1.0.6-a

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latest-thinking/lt-player",
3
- "version": "1.0.5-n",
3
+ "version": "1.0.6-a",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -33,6 +33,7 @@
33
33
  "fixed": "^0.3.1",
34
34
  "hammerjs": "^2.0.8",
35
35
  "handlebars": "^4.7.7",
36
+ "hls.js": "^1.4.1-0.canary.9078",
36
37
  "html-loader": "^3.1.0",
37
38
  "json-schema-library": "^7.4.4",
38
39
  "mini-css-extract-plugin": "^2.5.1",
@@ -73,7 +73,7 @@
73
73
  }
74
74
 
75
75
  @mixin buttons-xs {
76
- padding: 8px 8px;
76
+ padding: 7px 7px;
77
77
 
78
78
  img {
79
79
  width: 16px;
@@ -49,6 +49,45 @@
49
49
  }
50
50
  }
51
51
 
52
+ .lt-player-landscape--mobile,
53
+ .lt-player-landscape--desktop {
54
+ &.lt-player--landscape {
55
+ &__xxs {
56
+ .plyr {
57
+ .lt-player {
58
+ &__poster {
59
+ &__body {
60
+ .content {
61
+ &__header {
62
+ padding: 10px;
63
+ }
64
+
65
+ &__body {
66
+ padding: 0 10px;
67
+
68
+ .poster-paragraph {
69
+ font-size: 16px;
70
+ }
71
+ }
72
+
73
+ &__footer {
74
+ padding: 15px 10px;
75
+
76
+ .poster-buttons {
77
+ button {
78
+ @include buttons-sm;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+
52
91
  .lt-player-portrate--mobile {
53
92
  &.lt-player--portrait {
54
93
  &__xs {
@@ -1,122 +1,145 @@
1
+ //.lt-player-portrate--mobile,
2
+ //.lt-player-portrate--desktop,
3
+ //.lt-player-landscape--mobile {
4
+ // .plyr {
5
+ // .share-controller {
6
+ // .share-active {
7
+ // position: relative;
8
+ //
9
+ //
10
+ // .share-controller-content {
11
+ // max-width: 100%;
12
+ // .line-button {
13
+ // visibility: visible;
14
+ // margin-bottom: 32px;
15
+ // }
16
+ // }
17
+ // }
18
+ // }
19
+ // }
20
+ //}
21
+
1
22
  .plyr {
2
- .share-controller {
23
+ .share-controller {
24
+ .share-inactive {
25
+ display: none;
26
+ }
3
27
 
4
- .share-inactive {
5
- display: none;
6
- }
28
+ .share-active {
29
+ align-items: center;
30
+ background: rgba(0, 0, 0, .3);
31
+ -webkit-backdrop-filter: blur(14px);
32
+ backdrop-filter: blur(14px);
33
+ bottom: 0;
34
+ color: $default-lt-player-white;
35
+ display: flex;
36
+ justify-content: center;
37
+ left: 0;
38
+ position: absolute;
39
+ right: 0;
40
+ top: 0;
41
+ z-index: 99;
42
+
43
+ .share-controller-content {
44
+ background: $default-lt-player-white;
45
+ padding: 0 28px 20px;
46
+ text-align: center;
47
+ width: 100%;
48
+ max-width: 376px;
49
+
50
+ .line-button {
51
+ display: flex;
52
+ width: 56px;
53
+ height: 6px;
54
+ background-color: $default-lt-line-button;
55
+ margin: 8px auto;
56
+ cursor: pointer;
57
+ visibility: hidden;
58
+ }
7
59
 
8
- .share-active {
9
- align-items: center;
10
- background: rgba(0,0,0,.3);
11
- -webkit-backdrop-filter: blur(14px);
12
- backdrop-filter: blur(14px);
13
- bottom: 0;
14
- color: #fff;
15
- display: flex;
16
- justify-content: center;
17
- left: 0;
18
- position: absolute;
19
- right: 0;
20
- top: 0;
21
- z-index: 99;
22
-
23
- .share-controller-content {
24
- background: #fff;
25
- border-radius: 10px;
26
- max-width: 90%;
27
- padding: 40px;
28
- text-align: center;
29
-
30
- .share-controller-frame {
31
- position: relative;
32
-
33
- .player-share-close-button {
34
- color: #000;
35
- position: absolute;
36
- right: -20px;
37
- top: -20px;
38
- }
60
+ .share-controller-frame {
61
+ position: relative;
39
62
 
63
+ .player-share-close-button {
64
+ color: $default-lt-player-black;
65
+ position: absolute;
66
+ right: -20px;
67
+ top: -20px;
68
+ }
69
+ }
40
70
 
71
+ .share-controller-title,
72
+ .share-controller-via {
73
+ h3 {
74
+ color: $default-lt-button-color;
75
+ font-size: $lt-player-font-size-base;
76
+ font-weight: $lt-player-font-weight-lg;
77
+ margin-top: 0;
41
78
  }
79
+ }
42
80
 
43
- .share-controller-title {
44
- margin-bottom: 30px;
45
- span {
46
- color: #181818;
47
- font-size: 32px;
48
- font-weight: 700;
49
- }
81
+ .share-controller-via {
82
+ margin-bottom: 25px;
83
+ }
50
84
 
85
+ .share-controller-link-wrapper {
86
+ @extend %center-elements;
87
+ flex-flow: column wrap;
88
+ gap: 20px;
89
+ word-break: break-word;
90
+
91
+ .share-controller-url {
92
+ font-size: $lt-player-font-size-base;
93
+ color: $default-lt-player-modal-color;
94
+ font-weight: $lt-player-font-weight-sm;
95
+ text-decoration: underline;
96
+ cursor: pointer;
97
+ max-width: 90%;
51
98
  }
52
99
 
53
- .share-controller-link-wrapper {
54
- align-items: center;
55
- display: flex;
56
- //padding: 0 20px;
57
-
58
- input.share-controller-url {
59
- border: none;
60
- color: rgba(24,24,24,.5);
61
- flex: 1;
62
- font-size: 12px;
63
- overflow: hidden;
64
- text-align: center;
65
- white-space: nowrap;
66
- }
67
- .share-controller-link {
68
- color: #6cf;
69
- font-weight: 500;
70
- margin-left: 20px;
71
- white-space: nowrap;
72
- }
73
- }
74
- .share-controller-hr {
75
- border-top: 2px solid #eee;
76
- margin-top: 5px;
77
- }
78
- .share-controller-via {
79
- color: #181818;
80
- font-size: 18px;
81
- margin: 30px 0;
100
+ .share-controller-link {
101
+ @extend %lt-player-btn;
102
+ @include yellow-btn;
103
+ color: $default-lt-button-color !important;
104
+ max-width: 142px;
105
+ width: 100%;
82
106
  }
107
+ }
83
108
 
84
- .share-controller-icons {
85
- display: flex;
86
- justify-content: center;
109
+ .share-controller-hr {
110
+ opacity: 0.3;
111
+ margin: 20px 0;
112
+ }
87
113
 
88
- a {
89
- align-items: center;
90
- display: flex;
91
- flex-direction: column;
92
- margin: 0 7px;
93
- text-align: center;
94
-
95
- .share-icon__icon {
96
- border-radius: 50%;
97
- box-shadow: 0 4px 20px rgba(0,0,0,.1);
98
- display: block;
99
- margin-bottom: 5px;
100
- max-height: 35px;
101
- max-width: 35px;
102
-
103
- img {
104
- max-width: 35px;
105
- }
106
- }
107
- span {
108
- color: #181818;
109
- font-size: 12px;
110
- font-weight: 300;
111
- }
114
+ .share-controller-icons {
115
+ @extend %center-elements;
116
+ gap: 15px;
117
+ flex-wrap: wrap;
112
118
 
119
+ div {
120
+ display: none;
113
121
  }
114
122
 
123
+ a {
124
+ padding: 0;
115
125
 
126
+ &:first-child {
127
+ .share-icon__icon {
128
+ background: $default_color_player;
129
+ }
130
+ }
131
+
132
+ .share-icon__icon {
133
+ @extend %center-elements;
134
+ width: 32px;
135
+ height: 32px;
136
+ max-width: 32px;
137
+ max-height: 32px;
138
+ background: $default-lt-button-color;
139
+ }
116
140
  }
117
141
  }
118
-
119
142
  }
120
143
  }
121
-
144
+ }
122
145
  }
@@ -1,3 +1,16 @@
1
+ .lt-player-landscape--mobile,
2
+ .lt-player-landscape--desktop {
3
+ &.lt-player--landscape {
4
+ &__xxs {
5
+ .plyr {
6
+ .plyr__caption {
7
+ font-size: $lt-player-font-size-base !important;
8
+ }
9
+ }
10
+ }
11
+ }
12
+ }
13
+
1
14
  .plyr__caption {
2
15
  display: flex!important;
3
16
  justify-content: center!important;
@@ -171,15 +171,17 @@
171
171
  .plyr {
172
172
  &__progress {
173
173
  &--wrapper {
174
- bottom: 70px;
174
+ padding: 0 10px;
175
+ bottom: 50px;
175
176
  }
176
177
  }
177
178
 
178
179
  &__controls {
179
180
  .bottom-controller {
181
+ padding: 15px 10px;
182
+
180
183
  .play-button {
181
184
  padding: 12px;
182
- bottom: -2px;
183
185
  }
184
186
 
185
187
  .plyr__controls_speed-button {
@@ -199,6 +201,10 @@
199
201
  gap: 16px;
200
202
  }
201
203
 
204
+ &__center-buttons {
205
+ gap: 20px;
206
+ }
207
+
202
208
  &__previous-chapter-view {
203
209
  display: none;
204
210
  }
@@ -225,10 +231,6 @@
225
231
  &__right-buttons {
226
232
  direction: unset;
227
233
  }
228
-
229
- &__play-button_body {
230
- bottom: -3px;
231
- }
232
234
  }
233
235
  }
234
236
  }
@@ -16,6 +16,25 @@
16
16
  }
17
17
  }
18
18
 
19
+ .lt-player-landscape--mobile,
20
+ .lt-player-landscape--desktop {
21
+ &.lt-player--landscape {
22
+ &__xxs {
23
+ .plyr {
24
+ &__controls {
25
+ .top-controllers {
26
+ padding: 10px;
27
+
28
+ button {
29
+ @include buttons-xs;
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+
19
38
  .lt-player-portrate--mobile,
20
39
  .lt-player-portrate--desktop {
21
40
  &.lt-player--portrait {
@@ -64,6 +83,7 @@
64
83
  height: 20%;
65
84
  background: var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));
66
85
  rotate: 180deg;
86
+ display: none;
67
87
  }
68
88
 
69
89
  &__body {
@@ -0,0 +1,29 @@
1
+ import {LTPlayer} from "./LTPlayerType";
2
+ import {LTPlayerConfig} from "./config/LTPlayerConfig";
3
+ import Hls from "hls.js";
4
+ import {defaultType} from "../global/types/ModuleTypes";
5
+
6
+ export class LTPlayerHls {
7
+ instance : LTPlayer.LandscapeType | LTPlayer.PortraitType
8
+ config : LTPlayerConfig
9
+ playerSettings : defaultType
10
+
11
+ hlsInstance : Hls
12
+
13
+ constructor(instance : LTPlayer.LandscapeType | LTPlayer.PortraitType, playerSettings : defaultType) {
14
+ this.instance = instance;
15
+ this.config = instance.playerConfig;
16
+ this.playerSettings = playerSettings;
17
+ this.hlsInstance = new Hls();
18
+ }
19
+
20
+ init() {
21
+ if (Hls.isSupported()) {
22
+ this.hlsInstance.loadSource(this.config.getVideoUrl().videoUrl);
23
+ this.hlsInstance.attachMedia(this.config.getPlayerElementContainer().querySelector('video'));
24
+ this.hlsInstance.on(Hls.Events.MANIFEST_PARSED,function() {
25
+ console.log('MANIFEST_PARSED');
26
+ });
27
+ }
28
+ }
29
+ }
@@ -8,8 +8,8 @@ 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
- import {LTPlayerPosterManager} from "./poster/LTPlayerPosterManager";
12
- import {config} from "json-schema-library";
11
+ import {Helper} from "../services/Helper";
12
+ import {LTPlayerHls} from "./LTPlayerHls";
13
13
 
14
14
  export namespace LTPlayer {
15
15
 
@@ -45,6 +45,10 @@ export namespace LTPlayer {
45
45
  this.additionalInfoService.init(this, this.playerConfig.getPlayerId(), this.iconService, this.templateService)
46
46
  }
47
47
 
48
+ if (Helper.checkIsHls(this.playerConfig.getVideoUrl().videoUrl)){
49
+ this.hls = new LTPlayerHls(this, undefined);
50
+ }
51
+
48
52
  this.setEvents();
49
53
 
50
54
  return true;
@@ -116,7 +120,7 @@ export namespace LTPlayer {
116
120
 
117
121
  Object.assign(playerSettings, this.playerConfig.getDefaultConfigItems());
118
122
 
119
- Object.assign(playerSettings, {ratios : '9:16'});
123
+ Object.assign(playerSettings, {ratio : '9:16'});
120
124
 
121
125
  if (this.playerConfig.getFullscreenMode()) {
122
126
  Object.assign(playerSettings, this.playerConfig.getFullscreenMode());
@@ -124,7 +128,9 @@ export namespace LTPlayer {
124
128
 
125
129
  const element = this.playerConfig.getPlayerElementContainer().querySelector('.embed_player');
126
130
 
127
- const player = new Plyr(element, playerSettings)
131
+ const player = new Plyr(element, playerSettings);
132
+
133
+ this.playerConfig.setObjectFit(player, 'portrait');
128
134
 
129
135
  this.windowService.init(this);
130
136
 
@@ -216,6 +222,13 @@ export namespace LTPlayer {
216
222
  this.miniPlayer = new LTPlayerMini();
217
223
  this.setPlayerConfig(configData.body, configData.version);
218
224
  this.initPlayer();
225
+
226
+
227
+ if (Helper.checkIsHls(this.playerConfig.getVideoUrl().videoUrl)){
228
+ this.hls = new LTPlayerHls(this, undefined);
229
+ }
230
+
231
+
219
232
  this.setEvents();
220
233
 
221
234
  return true;
@@ -243,7 +256,7 @@ export namespace LTPlayer {
243
256
 
244
257
  Object.assign(playerSettings, this.playerConfig.getDefaultConfigItems());
245
258
 
246
- Object.assign(playerSettings, {ratios : '16:9'});
259
+ Object.assign(playerSettings, {ratio : '16:9'});
247
260
 
248
261
  if (this.playerConfig.getFullscreenMode()) {
249
262
  Object.assign(playerSettings, this.playerConfig.getFullscreenMode());
@@ -253,6 +266,8 @@ export namespace LTPlayer {
253
266
 
254
267
  const player = new Plyr(element, playerSettings);
255
268
 
269
+ this.playerConfig.setObjectFit(player, 'landscape');
270
+
256
271
  this.windowService.init(this);
257
272
 
258
273
  this.plyr = player;
@@ -1,5 +1,7 @@
1
1
  import {playerConfigType} from "../../global/types/ModuleTypes";
2
2
  import {LTPlayerConfigProcessor} from "./LTPlayerConfigProcessor";
3
+ import {Helper} from "../../services/Helper";
4
+ import Plyr from "plyr";
3
5
  export class LTPlayerConfig {
4
6
 
5
7
  private configData: playerConfigType = {
@@ -61,6 +63,25 @@ export class LTPlayerConfig {
61
63
  })
62
64
  }
63
65
 
66
+ setObjectFit(plyr : Plyr, instanceType : string) {
67
+ if (plyr.isHTML5) {
68
+
69
+ const videoTag = plyr.elements.wrapper.querySelector('video');
70
+
71
+ if (videoTag) {
72
+
73
+ videoTag.addEventListener('loadedmetadata', (event)=> {
74
+
75
+ const type = Helper.getVideoOrientation(videoTag.videoWidth, videoTag.videoHeight);
76
+
77
+ if (type === instanceType) {
78
+ videoTag.style.objectFit = 'cover';
79
+ }
80
+ })
81
+ }
82
+ }
83
+ }
84
+
64
85
  setVersion(version : string | number) {
65
86
 
66
87
  if (typeof version === 'string') {
@@ -66,11 +66,11 @@ export class LTPlayerDesktopSettingsControllers implements SettingsControlsInter
66
66
 
67
67
  myRange.oninput = function() {
68
68
  player.speed = parseFloat(values[rangeInput.value]);
69
- myValue.innerHTML = values[rangeInput.value];
69
+ myValue.innerHTML = `${values[rangeInput.value]}X`;
70
70
  };
71
71
 
72
72
  player.speed = parseFloat(String(values[0]));
73
- myValue.innerHTML = values[0];
73
+ myValue.innerHTML = `${values[0]}X`;
74
74
  }
75
75
  initSaveButton() {
76
76
 
@@ -22,7 +22,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
22
22
  setButtonSpeed() {
23
23
  let playerControlsContainer = this.settingsInstance.playerInstance.plyr.elements.controls;
24
24
  let playerSpeedButton = playerControlsContainer.querySelector('.plyr__controls_speed-button');
25
- playerSpeedButton.innerHTML = `${this.settingsInstance.playerInstance.plyr.speed}`;
25
+ playerSpeedButton.innerHTML = `${this.settingsInstance.playerInstance.plyr.speed}X`;
26
26
  let plyr = this.settingsInstance.playerInstance.plyr;
27
27
  let instance = this.settingsInstance.playerInstance;
28
28
 
@@ -34,19 +34,19 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
34
34
  let playSpeed = plyr.speed + 0.25;
35
35
 
36
36
  if (playSpeed > 2) {
37
- playerSpeedButton.innerHTML = '1';
37
+ playerSpeedButton.innerHTML = `1x`;
38
38
  plyr.speed = 1;
39
39
  return;
40
40
  }
41
41
 
42
42
  if (playSpeed === 1.75) {
43
43
  plyr.speed = playSpeed + 0.25
44
- playerSpeedButton.innerHTML = `${playSpeed + 0.25}`;
44
+ playerSpeedButton.innerHTML = `${playSpeed + 0.25}X`;
45
45
  return;
46
46
  }
47
47
 
48
48
  plyr.speed = playSpeed;
49
- playerSpeedButton.innerHTML = `${playSpeed}`;
49
+ playerSpeedButton.innerHTML = `${playSpeed}X`;
50
50
 
51
51
  instance.playerControl.mobileEvents.showControls(instance);
52
52
  })
@@ -109,14 +109,13 @@ export class LTPlayerCommon {
109
109
  onReadyPlayer() {
110
110
 
111
111
  //set share button
112
- this.player.share.events.desktop.init(this.player);
112
+ if (this.player.playerConfig.getShareData()) {
113
+ this.player.share.events.desktop.init(this.player);
114
+ }
113
115
 
114
- // this.player.windowService.init(this.player);
115
116
  //set poster
116
117
  this.player.posterManager.mobileEvents.onload(this.player);
117
118
 
118
-
119
-
120
119
  if (this.player.playerConfig.isAutoPlay()) {
121
120
  let playerContainer = this.player.plyr.elements.container;
122
121
 
@@ -59,6 +59,10 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
59
59
  eventManager.setDefaultSettingsConfig();
60
60
 
61
61
  if (instance.plyr.isHTML5) {
62
+
63
+ if (instance.hls) {
64
+ instance.hls.init();
65
+ }
62
66
  eventManager.onReadyPlayer();
63
67
  eventManager.modal(instance);
64
68
  instance.posterManager.desktopEvents.buttons(instance);
@@ -55,6 +55,11 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
55
55
  }
56
56
 
57
57
  if (instance.plyr.isHTML5) {
58
+
59
+ if (instance.hls) {
60
+ instance.hls.init();
61
+ }
62
+
58
63
  eventManager.onReadyPlayer();
59
64
  instance.posterManager.mobileEvents.buttons(instance);
60
65