@latest-thinking/lt-player 1.1.0 → 1.2.0-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.
- package/ README.md +126 -0
- 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/examples/basic.html +35 -0
- package/examples/lt-page-with-player.html +3529 -0
- package/examples/lt-page-with-player_files/Weiskopf_Coverphoto.jpg +0 -0
- package/examples/lt-page-with-player_files/ajax-progress.module.css +49 -0
- package/examples/lt-page-with-player_files/align.module.css +32 -0
- package/examples/lt-page-with-player_files/announce.js +49 -0
- package/examples/lt-page-with-player_files/autocomplete-loading.module.css +22 -0
- package/examples/lt-page-with-player_files/autocomplete.css +16 -0
- package/examples/lt-page-with-player_files/bootstrap.css +22691 -0
- package/examples/lt-page-with-player_files/clearfix.module.css +15 -0
- package/examples/lt-page-with-player_files/container-inline.module.css +16 -0
- package/examples/lt-page-with-player_files/cookiesjsr.min.css +10 -0
- package/examples/lt-page-with-player_files/core.css +97 -0
- package/examples/lt-page-with-player_files/details.module.css +10 -0
- package/examples/lt-page-with-player_files/fieldgroup.module.css +9 -0
- package/examples/lt-page-with-player_files/hidden.module.css +53 -0
- package/examples/lt-page-with-player_files/himme-alexander-beyond_0.jpg +0 -0
- package/examples/lt-page-with-player_files/item-list.module.css +19 -0
- package/examples/lt-page-with-player_files/js.module.css +22 -0
- package/examples/lt-page-with-player_files/latest_thinking.style.css +6496 -0
- package/examples/lt-page-with-player_files/logo-small.png +0 -0
- package/examples/lt-page-with-player_files/menu.css +64 -0
- package/examples/lt-page-with-player_files/nowrap.module.css +8 -0
- package/examples/lt-page-with-player_files/paragraphs.unpublished.css +3 -0
- package/examples/lt-page-with-player_files/position-container.module.css +8 -0
- package/examples/lt-page-with-player_files/progress.module.css +51 -0
- package/examples/lt-page-with-player_files/radix.style.css +1 -0
- package/examples/lt-page-with-player_files/reset-appearance.module.css +15 -0
- package/examples/lt-page-with-player_files/resize.module.css +21 -0
- package/examples/lt-page-with-player_files/search_api_autocomplete.css +41 -0
- package/examples/lt-page-with-player_files/sticky-header.module.css +13 -0
- package/examples/lt-page-with-player_files/system-status-counter.css +30 -0
- package/examples/lt-page-with-player_files/system-status-report-counters.css +27 -0
- package/examples/lt-page-with-player_files/system-status-report-general-info.css +14 -0
- package/examples/lt-page-with-player_files/tabledrag.module.css +98 -0
- package/examples/lt-page-with-player_files/tablesort.module.css +19 -0
- package/examples/lt-page-with-player_files/theme.css +446 -0
- package/examples/lt-page-with-player_files/thumbnail_MPI_CBS_Eingangsbereich.jpg +0 -0
- package/examples/lt-page-with-player_files/tree-child.module.css +18 -0
- package/examples/lt-page-with-player_files/widget-min.js +10 -0
- package/examples/lt-website.html +76 -0
- package/examples/portrait-with-subtitles.html +81 -0
- package/examples/samples/vtt/Pahl-Kerstin-Maria-MAIN-20230320.vtt +765 -0
- package/examples/samples/vtt/Sobolev-Anton-Subtitles-20230518_0.vtt +352 -0
- package/examples/samples/vtt/demo.vtt +7 -0
- package/package.json +1 -1
- package/src/assets/sass/abstracts/_mixins.scss +1 -1
- package/src/assets/sass/abstracts/_variables.scss +1 -1
- package/src/assets/sass/app.scss +19 -0
- package/src/assets/sass/components/_all.scss +1 -1
- package/src/assets/sass/components/_loader.scss +187 -0
- package/src/assets/sass/components/_modal.scss +6 -0
- package/src/assets/sass/core/_player.scss +23 -5
- package/src/assets/sass/sections/_additional-info.scss +1 -1
- package/src/assets/sass/sections/_control.scss +0 -1
- package/src/assets/sass/sections/_poster.scss +1 -0
- package/src/assets/sass/sections/_settings.scss +36 -53
- package/src/assets/sass/sections/_subtitles.scss +78 -23
- package/src/assets/sass/sections/controllers/_botom.scss +59 -36
- package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +29 -14
- package/src/assets/sass/sections/controllers/_top.scss +1 -1
- package/src/components/LTPlayerDevMethode.ts +106 -84
- package/src/components/LTPlayerManager.ts +16 -0
- package/src/components/LTPlayerSettingsManager.ts +117 -0
- package/src/components/LTPlayerSetup.ts +3 -10
- package/src/components/LTPlayerStatusFeedback.ts +76 -0
- package/src/components/LTPlayerStorage.ts +58 -0
- package/src/components/LTPlayerType.ts +10 -2
- package/src/components/LTPlayerUpdate.ts +61 -0
- package/src/components/captions/LTPlayerCaptions.ts +80 -0
- package/src/components/config/LTPlayerConfig.ts +43 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +110 -56
- package/src/components/controls/LTPlayerChapters.ts +8 -4
- package/src/components/controls/LTPlayerControls.ts +2 -0
- package/src/components/controls/LTPlayerControlsEvents.ts +231 -83
- package/src/components/controls/settings/LTPlayerCommonSettingsControllers.ts +9 -1
- package/src/components/controls/settings/LTPlayerDesktopSettingsControllers.ts +17 -14
- package/src/components/controls/settings/LTPlayerMobileSettingsControllers.ts +50 -44
- package/src/components/events/LTPlayer.ts +24 -21
- package/src/components/events/LTPlayerCommon.ts +94 -20
- package/src/components/events/LTPlayerDesktop.ts +21 -7
- package/src/components/events/LTPlayerMobile.ts +22 -10
- package/src/global/controllers/LTPlayerController.ts +7 -0
- package/src/services/Helper.ts +6 -1
- package/src/services/ResizeService.ts +35 -30
- package/src/services/TemplateService.ts +7 -0
- package/src/views/additionalInfo.handlebars +18 -18
- package/src/views/controls.handlebars +14 -3
- package/src/views/poster.handlebars +2 -2
- package/src/views/settings.handlebars +1 -1
- package/src/views/settings.mobile.handlebars +22 -0
- package/src/views/template.handlebars +4 -1
- package/src/assets/sass/components/_spinner.scss +0 -46
|
@@ -2,6 +2,7 @@ import {LTPlayerSettingsControlsManager} from "../LTPlayerSettingsControlsManage
|
|
|
2
2
|
import {SettingsControlsInterfaces} from "../../../global/interfaces/SettingsControlsInterfaces";
|
|
3
3
|
|
|
4
4
|
export class LTPlayerMobileSettingsControllers implements SettingsControlsInterfaces {
|
|
5
|
+
|
|
5
6
|
settingsInstance: LTPlayerSettingsControlsManager
|
|
6
7
|
constructor(settingsInstance: LTPlayerSettingsControlsManager) {
|
|
7
8
|
this.settingsInstance = settingsInstance;
|
|
@@ -11,6 +12,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
11
12
|
init() {
|
|
12
13
|
this.addOpenSettingsEventButton();
|
|
13
14
|
this.setButtonSpeed();
|
|
15
|
+
this.createModal();
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
addOpenSettingsEventButton() {
|
|
@@ -21,11 +23,10 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
21
23
|
if (mobileEvent) {
|
|
22
24
|
mobileEvent.on('singletap', function LTPlayerMobileSettingsButton() {
|
|
23
25
|
instance.settingsInstance.playerInstance.playerControl.mobileEvents.showControls(instance.settingsInstance.playerInstance);
|
|
24
|
-
instance.createModal();
|
|
25
|
-
instance.setActiveModal();
|
|
26
26
|
instance.initCaptionsEvent();
|
|
27
27
|
instance.initSpeedVideoEvent();
|
|
28
28
|
instance.initSaveButton();
|
|
29
|
+
instance.showModal()
|
|
29
30
|
setTimeout(() => {
|
|
30
31
|
instance.setInactiveTouchModal();
|
|
31
32
|
}, 100)
|
|
@@ -34,8 +35,24 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
hideModal() {
|
|
39
|
+
const body = document.body
|
|
40
|
+
body.removeAttribute('modal-open-body')
|
|
41
|
+
|
|
42
|
+
const modal = this.getModal()
|
|
43
|
+
modal.close()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
showModal() {
|
|
47
|
+
const body = document.body
|
|
48
|
+
body.setAttribute('modal-open-body', '')
|
|
49
|
+
|
|
50
|
+
const modal = this.getModal()
|
|
51
|
+
modal.showModal()
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
setInactiveTouchModal() {
|
|
38
|
-
const modal =
|
|
55
|
+
const modal = this.getModal()
|
|
39
56
|
const background = modal.querySelector('.settings-controllers-enable__background');
|
|
40
57
|
const settingsContainerHeader = modal.querySelector('.settings-controllers-header')
|
|
41
58
|
const instance = this;
|
|
@@ -46,10 +63,6 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
46
63
|
mobileEvent.on('singletap', function LTPlayerMobileSettingsBackground(event) {
|
|
47
64
|
instance.settingsInstance.playerInstance.playerControl.mobileEvents.showControls(instance.settingsInstance.playerInstance);
|
|
48
65
|
event.preventDefault();
|
|
49
|
-
let target = event.target as HTMLElement;
|
|
50
|
-
if (!target.classList.contains('settings-controllers')) {
|
|
51
|
-
instance.setInactiveModal();
|
|
52
|
-
}
|
|
53
66
|
})
|
|
54
67
|
}
|
|
55
68
|
}
|
|
@@ -61,64 +74,57 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
61
74
|
instance.settingsInstance.playerInstance.playerControl.mobileEvents.showControls(instance.settingsInstance.playerInstance);
|
|
62
75
|
event.preventDefault();
|
|
63
76
|
let target = event.target as HTMLElement;
|
|
64
|
-
instance.
|
|
77
|
+
instance.hideModal();
|
|
65
78
|
})
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
|
-
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const modal = document.createElement('div');
|
|
75
|
-
modal.classList.add('lt-player-mobile-settings-modal')
|
|
76
|
-
modal.innerHTML = modalTemplate;
|
|
77
|
-
|
|
78
|
-
const body = document.querySelector('body');
|
|
79
|
-
|
|
80
|
-
if (body) {
|
|
81
|
-
body.appendChild(modal);
|
|
82
|
-
}
|
|
83
|
+
getModal(): HTMLDialogElement {
|
|
84
|
+
const playerElementContainer = this.settingsInstance.playerInstance.playerConfig.getPlayerElementContainer()
|
|
85
|
+
return playerElementContainer.querySelector("dialog")
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
createModal() {
|
|
89
|
+
let settingsDialog = this.settingsInstance.playerInstance.templateService.getMobileSettings(
|
|
90
|
+
{
|
|
91
|
+
id : this.settingsInstance.playerInstance.playerConfig.getPlayerId(),
|
|
92
|
+
captions_enabled: this.settingsInstance.playerInstance.playerConfig.hasCaptionsUrl() &&
|
|
93
|
+
this.settingsInstance.playerInstance.playerConfig.getCaptionsEnabled(),
|
|
94
|
+
captions_missing: !this.settingsInstance.playerInstance.playerConfig.hasCaptionsUrl()
|
|
92
95
|
}
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
);
|
|
97
|
+
const playerElementContainer = this.settingsInstance.playerInstance.playerConfig.getPlayerElementContainer()
|
|
98
|
+
playerElementContainer.insertAdjacentHTML('beforeend', settingsDialog)
|
|
99
|
+
|
|
100
|
+
const modal = this.getModal()
|
|
101
|
+
modal.addEventListener('click', (e) => {
|
|
102
|
+
if (e.target === modal) {
|
|
103
|
+
this.hideModal()
|
|
104
|
+
}
|
|
105
|
+
});
|
|
95
106
|
|
|
96
|
-
setInactiveModal() {
|
|
97
|
-
const modal = document.querySelector('.lt-player-mobile-settings-modal');
|
|
98
|
-
if (modal) {
|
|
99
|
-
modal.remove();
|
|
100
|
-
}
|
|
101
107
|
}
|
|
108
|
+
|
|
102
109
|
initCaptionsEvent() {
|
|
103
|
-
const modal =
|
|
104
|
-
const checkBox = modal.querySelector(
|
|
110
|
+
const modal = this.getModal()
|
|
111
|
+
const checkBox = modal.querySelector(`.subtitles-body__input-switch`) as HTMLInputElement;
|
|
105
112
|
const instance = this;
|
|
106
113
|
if (checkBox) {
|
|
107
114
|
checkBox.addEventListener('change', () => {
|
|
108
115
|
instance.settingsInstance.playerInstance.playerControl.mobileEvents.showControls(instance.settingsInstance.playerInstance);
|
|
109
116
|
|
|
110
117
|
if (!checkBox.checked) {
|
|
111
|
-
this.settingsInstance.
|
|
112
|
-
|
|
118
|
+
this.settingsInstance.playerInstance.captionsService.disableCaptions();
|
|
119
|
+
} else {
|
|
120
|
+
this.settingsInstance.playerInstance.captionsService.enableCaptions();
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
this.settingsInstance.player.toggleCaptions(true);
|
|
116
|
-
|
|
117
123
|
})
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
initSpeedVideoEvent() {
|
|
121
|
-
const modal =
|
|
127
|
+
const modal = this.getModal()
|
|
122
128
|
const playerInstance = this.settingsInstance.playerInstance;
|
|
123
129
|
const player = this.settingsInstance.player;
|
|
124
130
|
const rangeInput: HTMLInputElement = modal.querySelector('.speed-range-input');
|
|
@@ -145,7 +151,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
145
151
|
myValue.innerHTML = `${values[0]}X`;
|
|
146
152
|
}
|
|
147
153
|
initSaveButton() {
|
|
148
|
-
const modal =
|
|
154
|
+
const modal = this.getModal()
|
|
149
155
|
const instance = this;
|
|
150
156
|
|
|
151
157
|
const saveButton = modal.querySelector('.button-save');
|
|
@@ -153,7 +159,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
153
159
|
saveButton.addEventListener('click', function (event) {
|
|
154
160
|
instance.settingsInstance.playerInstance.playerControl.mobileEvents.showControls(instance.settingsInstance.playerInstance);
|
|
155
161
|
event.preventDefault();
|
|
156
|
-
instance.
|
|
162
|
+
instance.hideModal();
|
|
157
163
|
})
|
|
158
164
|
}
|
|
159
165
|
setButtonSpeed() {
|
|
@@ -56,34 +56,35 @@ export namespace LTPlayerEvents {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const volumeControl = controls.querySelector('.bottom-controller__volume_control');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
if (volumeControl) {
|
|
60
|
+
const volumeButton = volumeControl.querySelector('.button-open');
|
|
61
|
+
const volumeBackground = volumeControl.querySelector('.volume_control__background');
|
|
62
|
+
const volumeBackgroundArea = volumeControl.querySelector('.volume_control__background__area');
|
|
63
|
+
const volumeArea = volumeControl.querySelector('.volume_control__background__area__range');
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (volumeButton) {
|
|
67
|
+
volumeButton.classList.remove('d-none');
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if (volumeBackground) {
|
|
71
|
+
volumeBackground.classList.add('d-none')
|
|
72
|
+
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if (volumeBackgroundArea) {
|
|
75
|
+
volumeBackgroundArea.classList.add('d-none')
|
|
76
|
+
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
if (volumeArea) {
|
|
79
|
+
volumeArea.classList.remove('volume-area-open')
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (volumeControl) {
|
|
83
|
+
volumeControl.classList.remove('volume-area-open');
|
|
84
|
+
volumeControl.classList.remove('volume-control-enable');
|
|
85
|
+
}
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
const controlsBackground = player.elements.container.querySelector('.plyr__controls__mobile-background');
|
|
87
88
|
if (controlsBackground) {
|
|
88
89
|
if (!controlsBackground.classList.contains('d-none')) {
|
|
89
90
|
controlsBackground.classList.add('d-none');
|
|
@@ -182,6 +183,8 @@ export namespace LTPlayerEvents {
|
|
|
182
183
|
if (!instance.plyr.elements.container.classList.contains('plyr__poster-enabled')) {
|
|
183
184
|
instance.plyr.elements.container.classList.add('plyr__poster-enabled');
|
|
184
185
|
}
|
|
186
|
+
|
|
187
|
+
instance.statusFeedbackService.clearLoading()
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
}
|
|
@@ -9,11 +9,23 @@ export class LTPlayerCommon {
|
|
|
9
9
|
player: LTPlayer.PortraitType | LTPlayer.LandscapeType;
|
|
10
10
|
plyr: Plyr;
|
|
11
11
|
|
|
12
|
+
setupCommon() {
|
|
13
|
+
this.playerPlay()
|
|
14
|
+
this.plyrOnPlaying()
|
|
15
|
+
this.plyrOnSeeking()
|
|
16
|
+
this.plyrOnControlsShown()
|
|
17
|
+
this.plyrOnCanplay()
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
playerPlay() {
|
|
13
21
|
const instance = this.player;
|
|
14
22
|
|
|
15
23
|
this.plyr.on('play', function LTPlayerPlay(event) {
|
|
16
24
|
|
|
25
|
+
if (!instance.plyr.elements.controls.classList.contains('plyr__controls-enable')) {
|
|
26
|
+
instance.plyr.elements.controls.classList.add('plyr__controls-enable');
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
instance.desktopEvents.playPause(event);
|
|
18
30
|
|
|
19
31
|
if (instance.additionalInfoService) {
|
|
@@ -27,26 +39,25 @@ export class LTPlayerCommon {
|
|
|
27
39
|
|
|
28
40
|
instance.plyr.speed = 1;
|
|
29
41
|
|
|
30
|
-
instance.plyr.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// }
|
|
42
|
+
if (!instance.plyr.isEmbed) {
|
|
43
|
+
let checkCaptions = (instance.plyr as plyr).captions;
|
|
44
|
+
|
|
45
|
+
if (checkCaptions.currentTrack >= 0) {
|
|
46
|
+
instance.plyr.toggleCaptions(true);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
instance.plyr.toggleCaptions(false);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
instance.plyr.embed.getTextTracks().then( (response: string | any[]) => {
|
|
54
|
+
if (response.length !== 0) {
|
|
55
|
+
instance.plyr.toggleCaptions(true);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
instance.plyr.toggleCaptions(false);
|
|
59
|
+
|
|
60
|
+
})
|
|
50
61
|
}
|
|
51
62
|
removeDesktopPlyrEvents() {
|
|
52
63
|
let plyrInstance = this.plyr as Plyr as Plyr & { eventListeners: Array<any> }
|
|
@@ -175,4 +186,67 @@ export class LTPlayerCommon {
|
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
|
|
189
|
+
setCustomSubtitles(controls: HTMLElement, event: Plyr.PlyrEvent )
|
|
190
|
+
{
|
|
191
|
+
const eventPlayer: any = event.detail.plyr;
|
|
192
|
+
|
|
193
|
+
const customSubtitlesElement = controls.querySelector('.lt-player-custom-captions');
|
|
194
|
+
const spanElement = customSubtitlesElement.querySelector('span');
|
|
195
|
+
|
|
196
|
+
if (!spanElement) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (!eventPlayer.captions.currentTrackNode.activeCues) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (eventPlayer.captions.currentTrackNode.activeCues.length > 0) {
|
|
203
|
+
spanElement.innerHTML = eventPlayer.captions.currentTrackNode.activeCues[0].text;
|
|
204
|
+
} else {
|
|
205
|
+
spanElement.innerHTML = ''; // Clear previous captions
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
clearCustomSubtitles(controls: HTMLElement)
|
|
210
|
+
{
|
|
211
|
+
const customSubtitlesElement = controls.querySelector('.lt-player-custom-captions');
|
|
212
|
+
const spanElement = customSubtitlesElement.querySelector('span');
|
|
213
|
+
|
|
214
|
+
if (!spanElement) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
spanElement.innerHTML = ''; // Clear previous captions
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
plyrOnSeeking() {
|
|
221
|
+
const instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
222
|
+
const plyr: Plyr = this.plyr;
|
|
223
|
+
plyr.on('seeking', () => {
|
|
224
|
+
instance.statusFeedbackService.setLoadingSeek()
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
plyrOnPlaying() {
|
|
229
|
+
const instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
230
|
+
const plyr: Plyr = this.plyr;
|
|
231
|
+
plyr.on('playing', () => {
|
|
232
|
+
instance.statusFeedbackService.clearLoading()
|
|
233
|
+
})
|
|
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
|
+
|
|
244
|
+
plyrOnControlsShown() {
|
|
245
|
+
const instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
246
|
+
const plyr: Plyr = this.plyr;
|
|
247
|
+
plyr.on('controlsshown', () => {
|
|
248
|
+
instance.statusFeedbackService.setControlsVisible()
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
|
|
178
252
|
}
|
|
@@ -13,7 +13,6 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
13
13
|
this.plyr = eventManager.plyr;
|
|
14
14
|
|
|
15
15
|
//init common events
|
|
16
|
-
this.playerPlay();
|
|
17
16
|
this.removeDesktopPlyrEvents();
|
|
18
17
|
|
|
19
18
|
//init desktop events
|
|
@@ -25,6 +24,9 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
25
24
|
this.plyrOnPlay();
|
|
26
25
|
this.plyrOnPause();
|
|
27
26
|
this.plyrOnSeek();
|
|
27
|
+
this.plyrOnCueChange();
|
|
28
|
+
|
|
29
|
+
this.setupCommon()
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
plyrOnSeek():void {
|
|
@@ -33,6 +35,10 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
33
35
|
let plyr: Plyr = this.plyr;
|
|
34
36
|
|
|
35
37
|
plyr.on('seeked', function LTPlayerSeek(){
|
|
38
|
+
if (plyr.stopped === true) {
|
|
39
|
+
eventManager.endVideo()
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
if (plyr.isEmbed) {
|
|
37
43
|
if (plyr.paused) {
|
|
38
44
|
return;
|
|
@@ -142,10 +148,8 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
142
148
|
|
|
143
149
|
plyr.on('enterfullscreen', function LTPlayerDesktopEnterFullScreen(event) {
|
|
144
150
|
//remove mini player on fullscreen
|
|
145
|
-
const target = event.target as HTMLElement;
|
|
146
|
-
const parent = target.closest('.lt-player');
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
instance.statusFeedbackService.setFullscreen()
|
|
149
153
|
instance.miniPlayer.event.removeMiniPLOnFullScreen(instance, 'enterfullscreen');
|
|
150
154
|
|
|
151
155
|
//fullscreen icon
|
|
@@ -157,10 +161,8 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
157
161
|
|
|
158
162
|
plyr.on('exitfullscreen', function LTPlayerDesktopExitFullScreen(event) {
|
|
159
163
|
//add mini player on exit fullscreen
|
|
160
|
-
const target = event.target as HTMLElement;
|
|
161
|
-
const parent = target.closest('.lt-player');
|
|
162
164
|
|
|
163
|
-
|
|
165
|
+
instance.statusFeedbackService.clearFullscreen()
|
|
164
166
|
instance.miniPlayer.event.removeMiniPLOnFullScreen(instance, 'exitfullscreen');
|
|
165
167
|
|
|
166
168
|
//fullscreen icon
|
|
@@ -190,6 +192,7 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
190
192
|
let instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
191
193
|
let plyr: Plyr = this.plyr;
|
|
192
194
|
plyr.on('play', function LTPlayerDesktopTimeUpdate(event) {
|
|
195
|
+
instance.statusFeedbackService.setLoading()
|
|
193
196
|
LoaderService.removeSpinner(plyr.elements.container)
|
|
194
197
|
instance.playerControl.desktopEvents.playPauseIcon(instance, 'timeupdate');
|
|
195
198
|
})
|
|
@@ -205,4 +208,15 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
205
208
|
})
|
|
206
209
|
}
|
|
207
210
|
|
|
211
|
+
plyrOnCueChange() {
|
|
212
|
+
let common = this;
|
|
213
|
+
let instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
214
|
+
let plyr: Plyr = this.plyr;
|
|
215
|
+
|
|
216
|
+
plyr.on('cuechange', function LTPlayerDesktopTimeUpdate(event) {
|
|
217
|
+
if (instance.playerConfig.getCaptionsEnabled() && plyr.currentTrack >= 0) {
|
|
218
|
+
common.setCustomSubtitles(plyr.elements.controls, event)
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
}
|
|
208
222
|
}
|
|
@@ -13,7 +13,6 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
13
13
|
this.plyr = eventManager.plyr;
|
|
14
14
|
|
|
15
15
|
//init common events
|
|
16
|
-
this.playerPlay();
|
|
17
16
|
this.removeMobilePlyrEvents();
|
|
18
17
|
|
|
19
18
|
//init mobile events
|
|
@@ -25,6 +24,9 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
25
24
|
this.plyrOnPlay();
|
|
26
25
|
this.plyrOnPause();
|
|
27
26
|
this.plyrOnSeek();
|
|
27
|
+
this.plyrOnCueChange()
|
|
28
|
+
|
|
29
|
+
this.setupCommon()
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
plyrOnSeek():void {
|
|
@@ -33,6 +35,10 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
33
35
|
let plyr: Plyr = this.plyr;
|
|
34
36
|
|
|
35
37
|
plyr.on('seeked', function LTPlayerSeek(){
|
|
38
|
+
if (plyr.stopped === true) {
|
|
39
|
+
eventManager.endVideo()
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
if (plyr.isEmbed) {
|
|
37
43
|
if (plyr.paused) {
|
|
38
44
|
return;
|
|
@@ -131,10 +137,7 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
131
137
|
let plyr: Plyr = this.plyr;
|
|
132
138
|
|
|
133
139
|
plyr.on('enterfullscreen', function LTPlayerDesktopEnterFullScreen(event) {
|
|
134
|
-
|
|
135
|
-
const parent = target.closest('.lt-player');
|
|
136
|
-
|
|
137
|
-
parent.classList.add('is-fullscreen');
|
|
140
|
+
instance.statusFeedbackService.setFullscreen()
|
|
138
141
|
instance.miniPlayer.event.removeMiniPLOnFullScreen(instance, 'enterfullscreen');
|
|
139
142
|
//fullscreen icon
|
|
140
143
|
instance.playerControl.desktopEvents.fullscreenIcon(instance, 'enterfullscreen');
|
|
@@ -143,10 +146,7 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
143
146
|
});
|
|
144
147
|
|
|
145
148
|
plyr.on('exitfullscreen', function LTPlayerDesktopExitFullScreen(event) {
|
|
146
|
-
|
|
147
|
-
const parent = target.closest('.lt-player');
|
|
148
|
-
|
|
149
|
-
parent.classList.remove('is-fullscreen');
|
|
149
|
+
instance.statusFeedbackService.clearFullscreen()
|
|
150
150
|
instance.miniPlayer.event.removeMiniPLOnFullScreen(instance, 'exitfullscreen');
|
|
151
151
|
//fullscreen icon
|
|
152
152
|
instance.playerControl.desktopEvents.fullscreenIcon(instance, 'exitfullscreen');
|
|
@@ -177,7 +177,7 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
177
177
|
let plyr: Plyr = this.plyr;
|
|
178
178
|
|
|
179
179
|
plyr.on('play', function LTPlayerDesktopTimeUpdate(event) {
|
|
180
|
-
|
|
180
|
+
instance.statusFeedbackService.setLoading()
|
|
181
181
|
instance.playerControl.desktopEvents.playPauseIcon(instance, 'timeupdate');
|
|
182
182
|
})
|
|
183
183
|
}
|
|
@@ -228,4 +228,16 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
228
228
|
return undefined;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
plyrOnCueChange() {
|
|
232
|
+
let common = this;
|
|
233
|
+
let instance: LTPlayer.PortraitType | LTPlayer.LandscapeType = this.player;
|
|
234
|
+
let plyr: Plyr = this.plyr;
|
|
235
|
+
|
|
236
|
+
plyr.on('cuechange', function LTPlayerDesktopTimeUpdate(event) {
|
|
237
|
+
if (instance.playerConfig.getCaptionsEnabled() && plyr.currentTrack >= 0) {
|
|
238
|
+
common.setCustomSubtitles(plyr.elements.controls, event)
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
231
243
|
}
|
|
@@ -13,6 +13,8 @@ import {LTPlayerPosterManager} from "../../components/poster/LTPlayerPosterManag
|
|
|
13
13
|
import {LTPlayerShareManager} from "../../components/share/LTPlayerShareManager";
|
|
14
14
|
import {LTPlayerHls} from "../../components/LTPlayerHls";
|
|
15
15
|
import {LTPlayerVideo} from "../../components/video/LTPlayerVideo";
|
|
16
|
+
import {LTPlayerCaptionsManager} from "../../components/captions/LTPlayerCaptions";
|
|
17
|
+
import {LTPlayerStatusFeedback} from "../../components/LTPlayerStatusFeedback";
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Default Player type Service
|
|
@@ -36,6 +38,9 @@ export class LTPlayerController {
|
|
|
36
38
|
share : LTPlayerShareManager
|
|
37
39
|
hls : LTPlayerHls
|
|
38
40
|
videoService : LTPlayerVideo
|
|
41
|
+
captionsService : LTPlayerCaptionsManager
|
|
42
|
+
statusFeedbackService: LTPlayerStatusFeedback
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* Base player type service
|
|
41
46
|
*/
|
|
@@ -47,5 +52,7 @@ export class LTPlayerController {
|
|
|
47
52
|
this.posterManager = new LTPlayerPosterManager();
|
|
48
53
|
this.share = new LTPlayerShareManager();
|
|
49
54
|
this.videoService = new LTPlayerVideo();
|
|
55
|
+
this.captionsService = new LTPlayerCaptionsManager(this);
|
|
56
|
+
this.statusFeedbackService = new LTPlayerStatusFeedback(this);
|
|
50
57
|
}
|
|
51
58
|
}
|
package/src/services/Helper.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {defaultType} from "../global/types/ModuleTypes";
|
|
2
2
|
|
|
3
3
|
export class Helper {
|
|
4
|
+
|
|
4
5
|
static getDevice() {
|
|
5
6
|
let device = 'desktop'; //initiate as false
|
|
6
7
|
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|
|
@@ -10,7 +11,11 @@ export class Helper {
|
|
|
10
11
|
return device;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
static setDebugEvent(data: string | object, type
|
|
14
|
+
static setDebugEvent(data: string | object, type?: string) {
|
|
15
|
+
if (type === undefined) {
|
|
16
|
+
type = 'info'
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
if (process.env.DEBUG === "true") {
|
|
15
20
|
switch (type) {
|
|
16
21
|
case 'info':
|
|
@@ -20,8 +20,8 @@ export class ResizeService {
|
|
|
20
20
|
playerType: string
|
|
21
21
|
addInfo: LTPLayerAddInfoResizeManager
|
|
22
22
|
|
|
23
|
-
addInfoOutSide:
|
|
24
|
-
addInfoInSide:
|
|
23
|
+
addInfoOutSide: false
|
|
24
|
+
addInfoInSide: true
|
|
25
25
|
|
|
26
26
|
playerParam: defaultType = {
|
|
27
27
|
width : null,
|
|
@@ -212,37 +212,42 @@ export class ResizeService {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// }
|
|
220
|
-
//
|
|
221
|
-
// if (this.addInfoOutSide) {
|
|
222
|
-
// return;
|
|
223
|
-
// }
|
|
224
|
-
//
|
|
225
|
-
// this.addInfoOutSide = true;
|
|
226
|
-
// this.addInfoInSide = false;
|
|
227
|
-
//
|
|
228
|
-
// createAddInfoButtonsOutSide();
|
|
229
|
-
// } else {
|
|
230
|
-
//
|
|
231
|
-
// if (this.addInfoOutSide && (containerWidth + 70 >= 380)) {
|
|
232
|
-
// return;
|
|
233
|
-
// }
|
|
234
|
-
//
|
|
235
|
-
// if (this.addInfoInSide) {
|
|
236
|
-
// return;
|
|
237
|
-
// }
|
|
238
|
-
//
|
|
239
|
-
// this.addInfoInSide = true;
|
|
240
|
-
// this.addInfoOutSide = false;
|
|
241
|
-
// createAddInfoButtonsInSide();
|
|
242
|
-
// }
|
|
215
|
+
if (this.playerInstance.playerConfig.getEmbed()) {
|
|
216
|
+
createAddInfoButtonsInSide();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
243
219
|
|
|
244
220
|
createAddInfoButtonsInSide();
|
|
245
221
|
|
|
222
|
+
|
|
223
|
+
// if (containerWidth >= 380) {
|
|
224
|
+
//
|
|
225
|
+
// if (this.addInfoInSide && (containerWidth + 70 <= 380)) {
|
|
226
|
+
// return;
|
|
227
|
+
// }
|
|
228
|
+
//
|
|
229
|
+
// if (this.addInfoOutSide) {
|
|
230
|
+
// return;
|
|
231
|
+
// }
|
|
232
|
+
//
|
|
233
|
+
// this.addInfoOutSide = true;
|
|
234
|
+
// this.addInfoInSide = false;
|
|
235
|
+
//
|
|
236
|
+
// createAddInfoButtonsOutSide();
|
|
237
|
+
// } else {
|
|
238
|
+
//
|
|
239
|
+
// if (this.addInfoOutSide && (containerWidth + 70 >= 380)) {
|
|
240
|
+
// return;
|
|
241
|
+
// }
|
|
242
|
+
//
|
|
243
|
+
// if (this.addInfoInSide) {
|
|
244
|
+
// return;
|
|
245
|
+
// }
|
|
246
|
+
//
|
|
247
|
+
// this.addInfoInSide = true;
|
|
248
|
+
// this.addInfoOutSide = false;
|
|
249
|
+
// createAddInfoButtonsInSide();
|
|
250
|
+
// }
|
|
246
251
|
}
|
|
247
252
|
|
|
248
253
|
protected setDimensions(containerWidth: number, containerHeight: number, defaultData: defaultType) {
|