@latest-thinking/lt-player 1.1.0-y → 1.2.0-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.1.0-y",
3
+ "version": "1.2.0-a",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -36,6 +36,13 @@ body {
36
36
  display: flex;
37
37
  width: 100%;
38
38
 
39
+
40
+ &__player {
41
+ &--no-radius {
42
+ border-radius: 0 !important;
43
+ }
44
+ }
45
+
39
46
  .plyr--video {
40
47
  background: transparent;
41
48
  }
@@ -19,6 +19,7 @@
19
19
 
20
20
  .line-button {
21
21
  @extend %line-button;
22
+ display: none;
22
23
  }
23
24
 
24
25
  .settings-text {
@@ -383,6 +384,14 @@
383
384
  min-width: 60px;
384
385
  height: 34px;
385
386
  margin-left: 10px;
387
+
388
+ &:has(.subtitles-body__input-switch[disabled]) {
389
+ .subtitles-body {
390
+ &__slider {
391
+ cursor: not-allowed;
392
+ }
393
+ }
394
+ }
386
395
  }
387
396
 
388
397
  &__input-switch {
@@ -500,4 +509,4 @@
500
509
  }
501
510
  }
502
511
  }
503
- }
512
+ }
@@ -7,6 +7,18 @@ export class LTPlayerCaptionsManager {
7
7
  this.player = player;
8
8
  }
9
9
 
10
+ enableSubtitlesCheckbox() {
11
+ const playerContainer = this.player.playerConfig.getPlayerElementContainer()
12
+ const subtitleCheckboxInput = playerContainer.querySelector('.subtitles-body__input-switch')
13
+ subtitleCheckboxInput.removeAttribute('disabled')
14
+ }
15
+
16
+ disableSubtitlesCheckbox() {
17
+ const playerContainer = this.player.playerConfig.getPlayerElementContainer()
18
+ const subtitleCheckboxInput = playerContainer.querySelector('.subtitles-body__input-switch')
19
+ subtitleCheckboxInput.setAttribute('disabled', '')
20
+ }
21
+
10
22
  setCaptions(src: string|null): void {
11
23
  const playerContainer = this.player.playerConfig.getPlayerElementContainer()
12
24
  const videoElement = playerContainer.querySelector("video")
@@ -32,9 +44,11 @@ export class LTPlayerCaptionsManager {
32
44
  newTrack.addEventListener(`load`, evt => {
33
45
  this.player.plyr.currentTrack = 0;
34
46
  });
35
-
47
+ this.enableSubtitlesCheckbox()
36
48
  this.player.plyr.toggleCaptions(true);
37
49
  videoElement.appendChild(newTrack);
50
+ } else {
51
+ this.disableSubtitlesCheckbox()
38
52
  }
39
53
  }
40
54
 
@@ -271,5 +271,10 @@ export class LTPlayerConfig {
271
271
  setCaptionsEnabled(status: boolean) {
272
272
  this.configData.captionsEnabled = status
273
273
  }
274
+
275
+ hasCaptionsUrl(): boolean {
276
+ const defaultConfig = this.getDefaultConfigItems();
277
+ return !!(defaultConfig.captions.url)
278
+ }
274
279
  }
275
280
 
@@ -13,7 +13,9 @@ export class LTPlayerCommonSettingsControllers {
13
13
  {
14
14
  id : this.instance.playerConfig.getPlayerId(),
15
15
  [string] : true,
16
- captions_enabled: this.instance.playerConfig.getCaptionsEnabled()
16
+ captions_enabled: this.instance.playerConfig.getCaptionsEnabled() &&
17
+ this.instance.playerConfig.hasCaptionsUrl(),
18
+ captions_missing: !this.instance.playerConfig.hasCaptionsUrl()
17
19
  }
18
20
  );
19
21
  const lastElement = this.instance.plyr.elements.controls.lastElementChild;
@@ -89,7 +89,9 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
89
89
  let settingsDialog = this.settingsInstance.playerInstance.templateService.getMobileSettings(
90
90
  {
91
91
  id : this.settingsInstance.playerInstance.playerConfig.getPlayerId(),
92
- captions_enabled: this.settingsInstance.playerInstance.playerConfig.getCaptionsEnabled()
92
+ captions_enabled: this.settingsInstance.playerInstance.playerConfig.hasCaptionsUrl() &&
93
+ this.settingsInstance.playerInstance.playerConfig.getCaptionsEnabled(),
94
+ captions_missing: !this.settingsInstance.playerInstance.playerConfig.hasCaptionsUrl()
93
95
  }
94
96
  );
95
97
  const playerElementContainer = this.settingsInstance.playerInstance.playerConfig.getPlayerElementContainer()
@@ -14,6 +14,7 @@ export class LTPlayerCommon {
14
14
  this.plyrOnPlaying()
15
15
  this.plyrOnSeeking()
16
16
  this.plyrOnControlsShown()
17
+ this.plyrOnCanplay()
17
18
  }
18
19
 
19
20
  playerPlay() {
@@ -232,6 +233,14 @@ export class LTPlayerCommon {
232
233
  })
233
234
  }
234
235
 
236
+ plyrOnCanplay() {
237
+ const instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
238
+ const plyr: Plyr = this.plyr;
239
+ plyr.on('canplay', () => {
240
+ instance.statusFeedbackService.clearLoading()
241
+ })
242
+ }
243
+
235
244
  plyrOnControlsShown() {
236
245
  const instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
237
246
  const plyr: Plyr = this.plyr;
@@ -4,7 +4,7 @@
4
4
  <div class="settings-controllers-enable__subtitles settings">
5
5
  <p class="settings-text settings">Subtitles</p>
6
6
  <label class="subtitles-body__switch settings">
7
- <input id="captions-lt-player-{{id}}" class="subtitles-body__input-switch settings" {{#captions_enabled }}checked{{/captions_enabled}} type="checkbox">
7
+ <input id="captions-lt-player-{{id}}" class="subtitles-body__input-switch settings" {{#captions_enabled }}checked{{/captions_enabled}} {{#captions_missing}}disabled{{/captions_missing}} type="checkbox">
8
8
  <label for="captions-lt-player-{{id}}" class="subtitles-body__slider settings"></label>
9
9
  </label>
10
10
  </div>
@@ -4,7 +4,7 @@
4
4
  <div class="settings-controllers-enable__subtitles settings">
5
5
  <p class="settings-text settings">Subtitles</p>
6
6
  <label class="subtitles-body__switch settings">
7
- <input id="captions-lt-player-{{id}}" class="subtitles-body__input-switch settings" {{#captions_enabled }}checked{{/captions_enabled}} type="checkbox">
7
+ <input id="captions-lt-player-{{id}}" class="subtitles-body__input-switch settings" {{#captions_enabled }}checked{{/captions_enabled}} {{#captions_missing}}disabled{{/captions_missing}} type="checkbox">
8
8
  <label for="captions-lt-player-{{id}}" class="subtitles-body__slider settings"></label>
9
9
  </label>
10
10
  </div>