@viewlift/player-backup 1.0.4-lighteningjs → 1.0.4

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 (130) hide show
  1. package/cjs/autoNextVideo-823821e8.js +1 -0
  2. package/cjs/bundle.css +657 -0
  3. package/cjs/caption-settings-67212c17.js +1 -0
  4. package/cjs/caption-settings-d42c056e.js +1 -0
  5. package/cjs/debugSelection-cbfdabb7.js +1 -0
  6. package/cjs/dvr_skin-f7f770ae.js +1 -0
  7. package/cjs/error-26d5a3c3.js +1 -0
  8. package/cjs/features-dfe03404.js +1 -0
  9. package/cjs/generic-8b99b151.js +1 -0
  10. package/cjs/icons-7afb9c13.js +1 -0
  11. package/cjs/index-1f8b5f12.js +1 -0
  12. package/cjs/index-2b74e462.js +1 -0
  13. package/cjs/index.js +1 -0
  14. package/cjs/keyboardShortcuts-cfd998c2.js +1 -0
  15. package/cjs/loader-393b838a.js +1 -0
  16. package/cjs/multicam-21c9a90b.js +1 -0
  17. package/cjs/multicam-a41fe4a6.js +1 -0
  18. package/cjs/multicamv2-76d8530b.js +1 -0
  19. package/cjs/multicamv2-c148fa24.js +1 -0
  20. package/cjs/mwebPotrait-3c11d7cf.js +1 -0
  21. package/cjs/mwebPotraitTray-b9d5d45a.js +1 -0
  22. package/cjs/nextEpisodeButton-300afadc.js +1 -0
  23. package/cjs/nextEpisodeButton-b6e6586f.js +1 -0
  24. package/cjs/nondvr_skin-ef2cb3b2.js +1 -0
  25. package/cjs/playlist-925f808b.js +1 -0
  26. package/cjs/playlist-df87ca90.js +1 -0
  27. package/cjs/renditions-bc841552.js +1 -0
  28. package/cjs/resolution-6a9adf54.js +1 -0
  29. package/cjs/series-82ec79d3.js +1 -0
  30. package/cjs/series-9c237975.js +1 -0
  31. package/cjs/series-v2-70137d8c.js +1 -0
  32. package/cjs/series-v2-7f4e41fd.js +1 -0
  33. package/cjs/settings-icon-a63f46fc.js +1 -0
  34. package/cjs/settings-icon-e6a8feee.js +1 -0
  35. package/cjs/skin-1eb7077c.js +1 -0
  36. package/cjs/skin-225252ff.js +1 -0
  37. package/cjs/skin-786d5e26.js +1 -0
  38. package/cjs/skin-84083352.js +1 -0
  39. package/cjs/skin-983a2ea7.js +1 -0
  40. package/cjs/skin-a01e3768.js +1 -0
  41. package/cjs/skin-afbec6d7.js +1 -0
  42. package/cjs/skin-c0b074fe.js +1 -0
  43. package/cjs/skin-e06fd04c.js +1 -0
  44. package/cjs/skin-f225a42e.js +1 -0
  45. package/cjs/util-fa21734a.js +1 -0
  46. package/cjs/videoSelector-4a02b437.js +1 -0
  47. package/cjs/videoSelector-fcdf11eb.js +1 -0
  48. package/esm/autoNextVideo-4aee2ee0.js +1 -0
  49. package/esm/bundle.css +657 -0
  50. package/esm/caption-settings-2e47813b.js +1 -0
  51. package/esm/caption-settings-f0f1945a.js +1 -0
  52. package/esm/debugSelection-2601b8b3.js +1 -0
  53. package/esm/dvr_skin-9cc1b144.js +1 -0
  54. package/esm/error-2395864b.js +1 -0
  55. package/esm/features-ba25c46d.js +1 -0
  56. package/esm/generic-6b0be7a7.js +1 -0
  57. package/esm/icons-c18c70b7.js +1 -0
  58. package/esm/index-57452e02.js +1 -0
  59. package/esm/index-c5a34630.js +1 -0
  60. package/esm/index.js +1 -0
  61. package/esm/keyboardShortcuts-5ecdd493.js +1 -0
  62. package/esm/loader-580278fe.js +1 -0
  63. package/esm/multicam-36c57c1e.js +1 -0
  64. package/esm/multicam-de741974.js +1 -0
  65. package/esm/multicamv2-8f58aca8.js +1 -0
  66. package/esm/multicamv2-d006cffa.js +1 -0
  67. package/esm/mwebPotrait-3c1805d8.js +1 -0
  68. package/esm/mwebPotraitTray-2229862a.js +1 -0
  69. package/esm/nextEpisodeButton-5f3b245a.js +1 -0
  70. package/esm/nextEpisodeButton-a1556cdf.js +1 -0
  71. package/esm/nondvr_skin-64be70e5.js +1 -0
  72. package/esm/playlist-75d710d0.js +1 -0
  73. package/esm/playlist-7ecf432a.js +1 -0
  74. package/esm/renditions-ddb320bd.js +1 -0
  75. package/esm/resolution-06ae4756.js +1 -0
  76. package/esm/series-041152aa.js +1 -0
  77. package/esm/series-9f68ec00.js +1 -0
  78. package/esm/series-v2-0727ee8c.js +1 -0
  79. package/esm/series-v2-72198a6e.js +1 -0
  80. package/esm/settings-icon-0125bffd.js +1 -0
  81. package/esm/settings-icon-52517438.js +1 -0
  82. package/esm/skin-0bb6f716.js +1 -0
  83. package/esm/skin-2c638dc1.js +1 -0
  84. package/esm/skin-31221b73.js +1 -0
  85. package/esm/skin-665ec17e.js +1 -0
  86. package/esm/skin-93e320fc.js +1 -0
  87. package/esm/skin-c16bc29b.js +1 -0
  88. package/esm/skin-cd537931.js +1 -0
  89. package/esm/skin-d5510f70.js +1 -0
  90. package/esm/skin-d66cd4fd.js +1 -0
  91. package/esm/skin-d6a8f25f.js +1 -0
  92. package/esm/util-f62bec40.js +1 -0
  93. package/esm/videoSelector-2689b3b6.js +1 -0
  94. package/esm/videoSelector-8e258d45.js +1 -0
  95. package/package.json +15 -33
  96. package/.babelrc +0 -8
  97. package/README.md +0 -29
  98. package/babel.config.json +0 -8
  99. package/dist/38afc79c94e0bcf0.png +0 -0
  100. package/dist/3bc8b7ff04e98d37.png +0 -0
  101. package/dist/522ea7c76ac4fd33.png +0 -0
  102. package/dist/a74cd46ed4277568.png +0 -0
  103. package/dist/b739faec1fde1346.png +0 -0
  104. package/dist/bundle.css +0 -2
  105. package/dist/bundle.css.map +0 -1
  106. package/dist/bundle.js +0 -38
  107. package/dist/bundle.js.map +0 -1
  108. package/dist/ed3d0a4d9de91460.png +0 -0
  109. package/index.html +0 -49
  110. package/jsconfig.json +0 -9
  111. package/rollup.config.mjs +0 -39
  112. package/src/ads-manager/ads-manager.js +0 -120
  113. package/src/assets/checkIcon.png +0 -0
  114. package/src/assets/pauseIcon.png +0 -0
  115. package/src/assets/pauseIconFocus.png +0 -0
  116. package/src/assets/playIcon.png +0 -0
  117. package/src/assets/playIconFocus.png +0 -0
  118. package/src/assets/settingsIcon.png +0 -0
  119. package/src/index.js +0 -13
  120. package/src/player-components/player-buttons/playerButtons.js +0 -106
  121. package/src/player-components/player-seekbar/playerSeekbar.js +0 -223
  122. package/src/player-components/player-setting-option-wrapper/player-setting-option-one-wrapper.js +0 -82
  123. package/src/player-components/player-setting-option-wrapper/player-setting-option-two-wrapper.js +0 -84
  124. package/src/player-components/player-sidebar/player-sidebar.js +0 -188
  125. package/src/player-components/player-title/playerTitle.js +0 -56
  126. package/src/player-ui/player-ui.js +0 -564
  127. package/src/playerControls/playerControls.css +0 -10
  128. package/src/playerControls/playerControls.js +0 -501
  129. package/src/styles/index.css +0 -204
  130. package/src/utilities/utilities.js +0 -79
@@ -1,564 +0,0 @@
1
- import { Button } from '../player-components/player-buttons/playerButtons.js';
2
- import { PlayerSeekbar } from '../player-components/player-seekbar/playerSeekbar.js';
3
- import { TextContent } from '../player-components/player-title/playerTitle.js';
4
- import { Sidebar } from '../player-components/player-sidebar/player-sidebar.js';
5
- import playIcon from '../assets/playIcon.png';
6
- import pauseIcon from '../assets/pauseIcon.png';
7
- import playIconFocus from '../assets/playIconFocus.png';
8
- import pauseIconFocus from '../assets/pauseIconFocus.png';
9
- import settingsIcon from '../assets/settingsIcon.png';
10
-
11
- class VideoPlayerUI {
12
- constructor({ player, config }) {
13
- if (!player || typeof player !== 'object' || !player.video) {
14
- throw new Error('VideoPlayerUI: player must be a valid object with a video property');
15
- }
16
- this.player = player;
17
- this.videoTitleConfig = config.videoTitleConfig || {};
18
-
19
- this.selectedVideoQuality = "auto";
20
- this.selectedPlaybackCaption = "";
21
- this.selectedAudioQuality = "";
22
-
23
- this.container = document.createElement('div');
24
- this.container.className = 'video-player-ui';
25
- this.rightSideContainer = document.createElement('div');
26
- this.rightSideContainer.className = 'right-side-container';
27
- this.leftSideContainer = document.createElement('div');
28
- this.leftSideContainer.className = 'left-side-container';
29
- this.container.appendChild(this.rightSideContainer);
30
- this.container.appendChild(this.leftSideContainer);
31
- this.createControls();
32
- }
33
-
34
- createControls() {
35
- this.createPlayPauseBtn();
36
- this.createSeekbar();
37
- this.createSettingsBtn();
38
- this.createRestartVideoBtn();
39
- this.createTextContent();
40
- this.addEventListeners();
41
-
42
- // Attach the video element
43
- this.container.appendChild(this.player.video);
44
- }
45
-
46
- createPlayPauseBtn() {
47
- this.playPauseBtn = new Button({
48
- imgSrc: playIconFocus,
49
- imgAltText: 'Play/Pause',
50
- buttonText: 'Play',
51
- width: 70,
52
- height: 70,
53
- klassname: 'play-pause-btn',
54
- focused: false,
55
- disabled: false,
56
- handleClick: () => {
57
- if (this.player.video.paused) {
58
- this.player.play();
59
- if (this.playPauseBtn && this.playPauseBtn.buttonElement && this.playPauseBtn.buttonElement.querySelector('img')) {
60
- this.playPauseBtn.buttonElement.querySelector('img').setAttribute('src', pauseIconFocus);
61
- } else if (this.playPauseBtn && this.playPauseBtn.buttonElement) {
62
- this.playPauseBtn.buttonElement.textContent = 'Pause';
63
- }
64
- } else {
65
- this.player.pause();
66
- if (this.playPauseBtn && this.playPauseBtn.buttonElement) {
67
- this.playPauseBtn.buttonElement.querySelector('img').setAttribute('src', playIconFocus);
68
- } else if (this.playPauseBtn && this.playPauseBtn.buttonElement) {
69
- this.playPauseBtn.buttonElement.textContent = 'Play';
70
- }
71
- }
72
- }
73
- });
74
- this.playPauseBtn.mount(this.container);
75
-
76
- requestAnimationFrame(() => {
77
- if (this.playPauseBtn) this.playPauseBtn.focus();
78
- });
79
-
80
- this.addPlayPauseBtnEventListeners();
81
- }
82
-
83
- addPlayPauseBtnEventListeners() {
84
- if (!this.playPauseBtn || !this.playPauseBtn.buttonElement) return;
85
-
86
- this.playPauseBtn.buttonElement.addEventListener('focus', () => {
87
- if (this.playPauseBtn && this.playPauseBtn.buttonElement && this.playPauseBtn.buttonElement.querySelector('img')) {
88
- const iconSrc = this.player.video.paused ? playIconFocus : pauseIconFocus;
89
- this.playPauseBtn.buttonElement.querySelector('img').setAttribute('src', iconSrc);
90
- this.playPauseBtn.buttonElement.style.backgroundColor = 'rgba(255, 255, 255)';
91
- }
92
- });
93
-
94
- this.playPauseBtn.buttonElement.addEventListener('blur', () => {
95
- if (this.playPauseBtn && this.playPauseBtn.buttonElement && this.playPauseBtn.buttonElement.querySelector('img')) {
96
- const iconSrc = this.player.video.paused ? playIcon : pauseIcon;
97
- this.playPauseBtn.buttonElement.querySelector('img').setAttribute('src', iconSrc);
98
- this.playPauseBtn.buttonElement.style.backgroundColor = 'rgba(255, 255, 255, 0.5)';
99
- }
100
- });
101
- }
102
-
103
- addSettingsBtnEventListeners() {
104
- if (!this.settingsBtn || !this.settingsBtn.buttonElement) return;
105
-
106
- this.settingsBtn.buttonElement.addEventListener('focus', () => {
107
- if (this.settingsBtn && this.settingsBtn.buttonElement && this.settingsBtn.buttonElement.querySelector('img')) {
108
- const iconSrc = this.player.video.paused ? playIconFocus : pauseIconFocus;
109
- this.settingsBtn.buttonElement.querySelector('img').setAttribute('src', iconSrc);
110
- this.settingsBtn.buttonElement.style.backgroundColor = 'rgba(255, 255, 255)';
111
- }
112
- });
113
-
114
- this.settingsBtn.buttonElement.addEventListener('blur', () => {
115
- if (this.settingsBtn && this.settingsBtn.buttonElement && this.settingsBtn.buttonElement.querySelector('img')) {
116
- const iconSrc = this.player.video.paused ? playIcon : pauseIcon;
117
- this.settingsBtn.buttonElement.querySelector('img').setAttribute('src', iconSrc);
118
- this.settingsBtn.buttonElement.style.backgroundColor = 'rgba(255, 255, 255, 0.5)';
119
- }
120
- });
121
- }
122
-
123
- updatePlayPauseButton() {
124
- if (this.playPauseBtn && this.playPauseBtn.buttonElement && this.seekbar.focused) {
125
- const iconSrc = this.player.video.paused ? playIcon : pauseIcon;
126
- this.playPauseBtn.buttonElement.querySelector('img').setAttribute('src', iconSrc);
127
- }
128
- }
129
-
130
- createSeekbar() {
131
- if (!this.player.video) return;
132
-
133
- this.seekbar = new PlayerSeekbar(this.player.video);
134
- this.seekbar.mount(this.container);
135
-
136
- this.player.video.addEventListener('play', () => this.updatePlayPauseButton());
137
- this.player.video.addEventListener('pause', () => this.updatePlayPauseButton());
138
- }
139
-
140
- addEventListeners() {
141
- if (!this.playPauseBtn || !this.playPauseBtn.buttonElement) return;
142
-
143
- this.playPauseBtn.buttonElement.addEventListener('keydown', (e) => {
144
- if (e.key === 'ArrowDown') {
145
- e.preventDefault();
146
- e.stopPropagation();
147
-
148
- if (this.settingsBtn) this.settingsBtn.focus();
149
- else if (this.restartVideoBtn) this.restartVideoBtn.focus();
150
- else if (this.seekbar) this.seekbar.focus();
151
- }
152
- });
153
-
154
- if (this.settingsBtn && this.settingsBtn.buttonElement) {
155
- this.settingsBtn.buttonElement.addEventListener('keydown', (e) => {
156
- if (e.key === 'ArrowDown') {
157
- e.preventDefault();
158
- e.stopPropagation();
159
- if (this.seekbar) this.seekbar.focus();
160
- } else if (e.key === 'ArrowUp') {
161
- e.preventDefault();
162
- e.stopPropagation();
163
- if (this.playPauseBtn) this.playPauseBtn.focus();
164
- } else if (e.key === 'ArrowRight') {
165
- e.preventDefault();
166
- e.stopPropagation();
167
- if (this.restartVideoBtn) this.restartVideoBtn.focus();
168
- }
169
- });
170
- }
171
-
172
- if (this.restartVideoBtn && this.restartVideoBtn.buttonElement) {
173
- this.restartVideoBtn.buttonElement.addEventListener('keydown', (e) => {
174
- if (e.key === 'ArrowDown') {
175
- e.preventDefault();
176
- e.stopPropagation();
177
- if (this.seekbar) this.seekbar.focus();
178
- } else if (e.key === 'ArrowUp') {
179
- e.preventDefault();
180
- e.stopPropagation();
181
- if (this.playPauseBtn) this.playPauseBtn.focus();
182
- } else if (e.key === 'ArrowLeft') {
183
- e.preventDefault();
184
- e.stopPropagation();
185
- if (this.settingsBtn) this.settingsBtn.focus();
186
- }
187
- });
188
- }
189
-
190
- const seekbarElement = this.seekbar.getElement && this.seekbar.getElement();
191
- if (seekbarElement) {
192
- seekbarElement.addEventListener('keydown', (e) => {
193
- if (e.key === 'ArrowUp') {
194
- e.preventDefault();
195
- e.stopPropagation();
196
-
197
- if (this.settingsBtn) this.settingsBtn.focus();
198
- else if (this.restartVideoBtn) this.restartVideoBtn.focus();
199
- else if (this.playPauseBtn) this.playPauseBtn.focus();
200
- }
201
- });
202
- }
203
- }
204
-
205
- createSettingsBtn() {
206
- this.settingsBtn = new Button({
207
- imgSrc: settingsIcon,
208
- imgAltText: 'Settings',
209
- buttonText: 'Settings',
210
- width: 40,
211
- height: 40,
212
- klassname: 'settings-btn',
213
- focused: false,
214
- disabled: false,
215
- handleClick: () => {
216
- this.createSideBar();
217
- this.hidePlayerControls();
218
- }
219
- });
220
- // this.addSettingsBtnEventListeners();
221
- this.settingsBtn.mount(this.rightSideContainer);
222
- }
223
-
224
- createRestartVideoBtn() {
225
- this.restartVideoBtn = new Button({
226
- imgSrc: '',
227
- imgAltText: 'Start From Beginning',
228
- buttonText: 'Start From Beginning',
229
- width: undefined,
230
- height: 35,
231
- fontWeight: 700,
232
- klassname: 'restart-btn',
233
- focused: false,
234
- disabled: false,
235
- handleClick: () => {
236
- if (this.player.video) {
237
- this.player.video.currentTime = 0;
238
- }
239
- }
240
- });
241
- this.restartVideoBtn.mount(this.rightSideContainer);
242
- }
243
-
244
- createTextContent() {
245
- this.textContent = new TextContent({
246
- text: this.videoTitleConfig.text,
247
- fontSize: this.videoTitleConfig.fontSize,
248
- color: this.videoTitleConfig.color,
249
- fontWeight: this.videoTitleConfig.fontWeight,
250
- });
251
- this.textContent.mount(this.leftSideContainer);
252
- }
253
-
254
- changePlayBackQuality(id) {
255
- this.selectedPlaybackQuality = id;
256
- let videoLevels = this.player.videoResolutions();
257
-
258
- if (!videoLevels || videoLevels.length === 0) {
259
- console.warn('No video resolutions available to change playback quality.');
260
- return;
261
- }
262
-
263
- if (id == "auto") {
264
- this.selectedVideoQuality = "auto";
265
- if (this.drmEnabled) {
266
-
267
- } else {
268
- this.player.playerInstance.currentLevel = -1;
269
- }
270
- } else {
271
- for (let i = 0; i < videoLevels?.length; i++) {
272
- if (videoLevels[i].height == id) {
273
- this.selectedVideoQuality = videoLevels[i].height;
274
- if (this.drmEnabled) {
275
- this.player.playerInstance.setQualityFor('video', i);
276
- } else {
277
- this.player.playerInstance.currentLevel = i;
278
- }
279
- break;
280
- }
281
- }
282
- }
283
- }
284
-
285
- changePlaybackCaptions(id) {
286
- let textTracks = this.player.captionsOptions();
287
-
288
- if (!textTracks || textTracks.length === 0) {
289
- console.warn('No text tracks available to change playback captions.');
290
- return;
291
- }
292
- const validTextTracksType = ['captions', 'subtitles', 'caption', 'subtitle'];
293
-
294
- for (let i = 0; i < textTracks.length; i++) {
295
- if(validTextTracksType.includes(textTracks[i].kind.toLowerCase())){
296
- if (textTracks[i].language === id) {
297
- this.selectedPlaybackCaption = id;
298
- textTracks[i].mode = 'showing';
299
- } else {
300
- textTracks[i].mode = 'disabled';
301
- }
302
- }
303
- }
304
- }
305
-
306
-
307
- changePlaybackAudio(id){
308
- let audioTracks = this.player.audioTracks();
309
-
310
- if (!audioTracks || audioTracks.length === 0) {
311
- console.warn('No audio tracks available to change playback audio.');
312
- return;
313
- }
314
-
315
- for (let i = 0; i < audioTracks.length; i++) {
316
- if (audioTracks[i].id == id || audioTracks[i].lang == id) {
317
- this.selectedAudioQuality = id;
318
- if(this.drmEnabled){
319
- this.player.playerInstance.setCurrentTrack(audioTracks[i]);
320
- } else{
321
- this.player.playerInstance.audioTrack = i;
322
- }
323
- break;
324
- }
325
- }
326
- }
327
-
328
- videoQualitySelector() {
329
- if (!this.mainSidebar) return;
330
-
331
- const resolutions = this.player.videoResolutions();
332
- const currentQuality = this.selectedVideoQuality;
333
-
334
- const items = [
335
- {
336
- text: 'Auto',
337
- id: 'auto',
338
- isSelected: currentQuality === 'auto',
339
- callback: () => {
340
- this.mainSidebar.currentFocusedOption.focus();
341
- this.sidebar.unmount();
342
- }
343
- },
344
- ...resolutions.map(resolution => ({
345
- text: `${resolution.height}p`,
346
- id: resolution.height,
347
- isSelected: currentQuality === resolution.height,
348
- callback: () => {
349
- this.mainSidebar.currentFocusedOption.focus();
350
- this.sidebar.unmount();
351
- }
352
- }))
353
- ];
354
-
355
-
356
- this.sidebar = new Sidebar({
357
- title: 'Video Quality',
358
- items: items,
359
- klassname: 'default-sidebar',
360
- lastFocusedElement: this.mainSidebar.currentFocusedOption,
361
- type: 'selection',
362
- focused: true,
363
- onselect: (data) => {
364
- this.changePlayBackQuality(data.id);
365
- },
366
- callback: () => {
367
- if (this.mainSidebar.sidebarElement) {
368
- this.mainSidebar.sidebarElement.style.visibility = 'visible';
369
- }
370
- }
371
- });
372
- this.sidebar.mount(this.container);
373
- }
374
-
375
- audioLanguageSelector() {
376
- if (!this.mainSidebar) return;
377
- const audioTracks = this.player.audioTracks();
378
- const currentAudioQuality = this.selectedAudioQuality;
379
-
380
- this.sidebar = new Sidebar({
381
- title: 'Audio Language',
382
- items: audioTracks.map((audio, idx) => ({
383
- id: audio.id || audio.lang,
384
- text: audio.name || audio.lang,
385
- isSelected: (audioTracks.length === 1) || (currentAudioQuality ? currentAudioQuality === audio.id : audio.default),
386
- callback: () => {
387
- this.mainSidebar.currentFocusedOption.focus();
388
- this.sidebar.unmount();
389
- }
390
- })),
391
- klassname: 'default-sidebar',
392
- lastFocusedElement: this.mainSidebar.currentFocusedOption,
393
- type: 'selection',
394
- focused: true,
395
- onselect: (data) => {
396
- this.changePlaybackAudio(data.id);
397
- },
398
- callback: () => {
399
- if (this.mainSidebar.sidebarElement) {
400
- this.mainSidebar.sidebarElement.style.visibility = 'visible';
401
- }
402
- }
403
- });
404
- this.sidebar.mount(this.container);
405
- }
406
-
407
- subtitlesSelector() {
408
- if (!this.mainSidebar) return;
409
-
410
- const captions = this.player.captionsOptions();
411
- const currentCaption = this.selectedPlaybackCaption;
412
-
413
-
414
- const items = [
415
- {
416
- id: 'off',
417
- text: 'Off',
418
- isSelected: currentCaption === 'off', // You can enhance this by checking if all tracks are disabled
419
- callback: () => {
420
- this.mainSidebar.currentFocusedOption.focus();
421
- this.sidebar.unmount();
422
- }
423
- },
424
- ...captions.map(subtitle => ({
425
- id: subtitle.language,
426
- text: subtitle.label,
427
- isSelected: currentCaption === subtitle.language || subtitle.mode === 'showing',
428
- callback: () => {
429
- this.mainSidebar.currentFocusedOption.focus();
430
- this.sidebar.unmount();
431
- }
432
- }))
433
- ];
434
-
435
-
436
- this.sidebar = new Sidebar({
437
- title: 'Subtitles',
438
- items: items,
439
- klassname: 'default-sidebar',
440
- lastFocusedElement: this.mainSidebar.currentFocusedOption,
441
- type: 'selection',
442
- focused: true,
443
- callback: () => {
444
- if (this.mainSidebar.sidebarElement) {
445
- this.mainSidebar.sidebarElement.style.visibility = 'visible';
446
- }
447
- },
448
- onselect: (data) => {
449
- this.changePlaybackCaptions(data.id);
450
- }
451
- });
452
- this.sidebar.mount(this.container);
453
- }
454
-
455
- createSideBar() {
456
- let items = [
457
- {
458
- text: 'Video Quality', isSelected: true, callback: () => {
459
- if (this.mainSidebar.sidebarElement) {
460
- this.mainSidebar.sidebarElement.style.visibility = 'hidden';
461
- }
462
- this.videoQualitySelector();
463
- }
464
- }
465
- ]
466
-
467
- if (this.player.audioTracks() && this.player.audioTracks().length > 0) {
468
- items.push(
469
- {
470
- text: 'Audio Language', isSelected: false, callback: () => {
471
- if (this.mainSidebar.sidebarElement) {
472
- this.mainSidebar.sidebarElement.style.visibility = 'hidden';
473
- }
474
- this.audioLanguageSelector();
475
- }
476
- }
477
- )
478
- }
479
-
480
- if (this.player.captionsOptions() && this.player.captionsOptions().length > 0) {
481
- items.push(
482
- {
483
- text: 'Subtitles', isSelected: false, callback: () => {
484
- if (this.mainSidebar.sidebarElement) {
485
- this.mainSidebar.sidebarElement.style.visibility = 'hidden';
486
- }
487
- this.subtitlesSelector();
488
- }
489
- }
490
- )
491
- }
492
-
493
- this.mainSidebar = new Sidebar({
494
- title: 'Settings',
495
- items: items,
496
- klassname: 'default-sidebar',
497
- lastFocusedElement: this.settingsBtn.buttonElement,
498
- type: 'navigation',
499
- focused: true,
500
- callback: () => {
501
- this.showPlayerControls();
502
- }
503
- });
504
- this.mainSidebar.mount(this.container);
505
- }
506
-
507
- hidePlayerControls() {
508
- if (this.rightSideContainer) {
509
- this.rightSideContainer.style.visibility = 'hidden';
510
- }
511
-
512
- if (this.seekbar) {
513
- this.seekbar.container.style.visibility = 'hidden';
514
- }
515
-
516
- if (this.leftSideContainer) {
517
- this.leftSideContainer.style.visibility = 'hidden';
518
- }
519
- }
520
-
521
- showPlayerControls() {
522
- if (this.rightSideContainer) {
523
- this.rightSideContainer.style.visibility = 'visible';
524
- }
525
-
526
- if (this.seekbar) {
527
- this.seekbar.container.style.visibility = 'visible';
528
- }
529
-
530
- if (this.leftSideContainer) {
531
- this.leftSideContainer.style.visibility = 'visible';
532
- }
533
- }
534
-
535
- attachTo(parent) {
536
- if (!parent || !(parent instanceof HTMLElement)) {
537
- throw new Error('VideoPlayerUI: parent must be a valid DOM element');
538
- }
539
- parent.appendChild(this.container);
540
- }
541
-
542
- getElement() {
543
- return this.container;
544
- }
545
-
546
- unmount() {
547
- if (this.playPauseBtn && this.playPauseBtn.buttonElement) {
548
- this.playPauseBtn.buttonElement.removeEventListener('focus', this.updatePlayPauseButton);
549
- this.playPauseBtn.buttonElement.removeEventListener('blur', this.updatePlayPauseButton);
550
- this.playPauseBtn.buttonElement.removeEventListener('keydown', this.handlePlayPauseKeydown);
551
- }
552
-
553
- if (this.player.video) {
554
- this.player.video.removeEventListener('play', this.updatePlayPauseButton);
555
- this.player.video.removeEventListener('pause', this.updatePlayPauseButton);
556
- }
557
-
558
- if (this.container) {
559
- this.container.remove();
560
- }
561
- }
562
- }
563
-
564
- export default VideoPlayerUI;
@@ -1,10 +0,0 @@
1
- #playerControlsContainer {
2
- width: 100%;
3
- height: 225px;
4
- bottom: 0px;
5
- position: absolute;
6
- outline-width: 0px;
7
- border-width: 0px;
8
- z-index: 1000;
9
- background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
10
- }