@viewlift/player-backup 1.0.2 → 1.0.3-lighteningjs

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 (134) hide show
  1. package/.babelrc +8 -0
  2. package/.browserslistrc +2 -0
  3. package/README.md +29 -0
  4. package/babel.config.json +8 -0
  5. package/dist/38afc79c94e0bcf0.png +0 -0
  6. package/dist/3bc8b7ff04e98d37.png +0 -0
  7. package/dist/522ea7c76ac4fd33.png +0 -0
  8. package/dist/a74cd46ed4277568.png +0 -0
  9. package/dist/b739faec1fde1346.png +0 -0
  10. package/dist/ed3d0a4d9de91460.png +0 -0
  11. package/dist/index.cjs.css +2 -0
  12. package/dist/index.cjs.css.map +1 -0
  13. package/dist/index.cjs.js +2 -0
  14. package/dist/index.d.ts +24 -0
  15. package/dist/index.esm.css +2 -0
  16. package/dist/index.esm.css.map +1 -0
  17. package/dist/index.esm.js +2 -0
  18. package/dist/main-player/player-ui.d.ts +19 -0
  19. package/dist/player-components/player-buttons/playerButtons.d.ts +38 -0
  20. package/dist/player-components/player-seekbar/playerSeekbar.d.ts +25 -0
  21. package/dist/player-ui/player-ui.d.ts +18 -0
  22. package/dist/playerInitializer.d.ts +13 -0
  23. package/index.html +49 -0
  24. package/package.json +35 -15
  25. package/rollup.config.mjs +45 -0
  26. package/src/ads-manager/ads-manager.js +120 -0
  27. package/src/assets/checkIcon.png +0 -0
  28. package/src/assets/pauseIcon.png +0 -0
  29. package/src/assets/pauseIconFocus.png +0 -0
  30. package/src/assets/playIcon.png +0 -0
  31. package/src/assets/playIconFocus.png +0 -0
  32. package/src/assets/settingsIcon.png +0 -0
  33. package/src/index.ts +74 -0
  34. package/src/player-components/player-buttons/playerButtons.js +106 -0
  35. package/src/player-components/player-seekbar/playerSeekbar.js +223 -0
  36. package/src/player-components/player-setting-option-wrapper/player-setting-option-one-wrapper.js +82 -0
  37. package/src/player-components/player-setting-option-wrapper/player-setting-option-two-wrapper.js +84 -0
  38. package/src/player-components/player-sidebar/player-sidebar.js +188 -0
  39. package/src/player-components/player-title/playerTitle.js +56 -0
  40. package/src/player-ui/player-ui.js +564 -0
  41. package/src/playerControls/playerControls.css +10 -0
  42. package/src/playerControls/playerControls.js +501 -0
  43. package/src/playerInitializer.js +335 -0
  44. package/src/styles/index.css +204 -0
  45. package/src/utilities/utilities.js +79 -0
  46. package/tsconfig.json +15 -0
  47. package/cjs/autoNextVideo-815419cb.js +0 -1
  48. package/cjs/bundle.css +0 -577
  49. package/cjs/caption-settings-67212c17.js +0 -1
  50. package/cjs/caption-settings-6e301004.js +0 -1
  51. package/cjs/dvr_skin-f7f770ae.js +0 -1
  52. package/cjs/error-26d5a3c3.js +0 -1
  53. package/cjs/features-fd1e9785.js +0 -1
  54. package/cjs/generic-81b1be69.js +0 -1
  55. package/cjs/icons-51594f89.js +0 -1
  56. package/cjs/index.js +0 -1
  57. package/cjs/keyboardShortcuts-1afbf18c.js +0 -1
  58. package/cjs/loader-393b838a.js +0 -1
  59. package/cjs/multicam-1647c428.js +0 -1
  60. package/cjs/multicam-a41fe4a6.js +0 -1
  61. package/cjs/multicamv2-76d8530b.js +0 -1
  62. package/cjs/multicamv2-f48d95fe.js +0 -1
  63. package/cjs/mwebPotrait-3c11d7cf.js +0 -1
  64. package/cjs/mwebPotraitTray-a3a2715b.js +0 -1
  65. package/cjs/nextEpisodeButton-b6e6586f.js +0 -1
  66. package/cjs/nextEpisodeButton-cc80609a.js +0 -1
  67. package/cjs/nondvr_skin-ef2cb3b2.js +0 -1
  68. package/cjs/playlist-a550a735.js +0 -1
  69. package/cjs/playlist-df87ca90.js +0 -1
  70. package/cjs/renditions-c3ea26e8.js +0 -1
  71. package/cjs/resolution-51b38a3e.js +0 -1
  72. package/cjs/series-6178964e.js +0 -1
  73. package/cjs/series-9c237975.js +0 -1
  74. package/cjs/series-v2-70137d8c.js +0 -1
  75. package/cjs/series-v2-a265ff17.js +0 -1
  76. package/cjs/settings-icon-b350b587.js +0 -1
  77. package/cjs/settings-icon-e6a8feee.js +0 -1
  78. package/cjs/skin-14da56f6.js +0 -1
  79. package/cjs/skin-225252ff.js +0 -1
  80. package/cjs/skin-286f52db.js +0 -1
  81. package/cjs/skin-534810ae.js +0 -1
  82. package/cjs/skin-638aecc2.js +0 -1
  83. package/cjs/skin-84083352.js +0 -1
  84. package/cjs/skin-983a2ea7.js +0 -1
  85. package/cjs/skin-9eba464b.js +0 -1
  86. package/cjs/skin-b703ef26.js +0 -1
  87. package/cjs/skin-f225a42e.js +0 -1
  88. package/cjs/util-ce8a4138.js +0 -1
  89. package/cjs/videoSelector-a4c00f50.js +0 -1
  90. package/cjs/videoSelector-fcdf11eb.js +0 -1
  91. package/esm/autoNextVideo-89ede579.js +0 -1
  92. package/esm/bundle.css +0 -577
  93. package/esm/caption-settings-2e47813b.js +0 -1
  94. package/esm/caption-settings-3f6b6163.js +0 -1
  95. package/esm/dvr_skin-9cc1b144.js +0 -1
  96. package/esm/error-2395864b.js +0 -1
  97. package/esm/features-05101ce6.js +0 -1
  98. package/esm/generic-4a3c0d6b.js +0 -1
  99. package/esm/icons-f5378bf3.js +0 -1
  100. package/esm/index.js +0 -1
  101. package/esm/keyboardShortcuts-7fa108ec.js +0 -1
  102. package/esm/loader-580278fe.js +0 -1
  103. package/esm/multicam-bc0aea8a.js +0 -1
  104. package/esm/multicam-de741974.js +0 -1
  105. package/esm/multicamv2-d006cffa.js +0 -1
  106. package/esm/multicamv2-fb91fa98.js +0 -1
  107. package/esm/mwebPotrait-3c1805d8.js +0 -1
  108. package/esm/mwebPotraitTray-0ff12233.js +0 -1
  109. package/esm/nextEpisodeButton-a1556cdf.js +0 -1
  110. package/esm/nextEpisodeButton-ec95417f.js +0 -1
  111. package/esm/nondvr_skin-64be70e5.js +0 -1
  112. package/esm/playlist-5d3f4436.js +0 -1
  113. package/esm/playlist-7ecf432a.js +0 -1
  114. package/esm/renditions-0fdb57ed.js +0 -1
  115. package/esm/resolution-57e7767a.js +0 -1
  116. package/esm/series-041152aa.js +0 -1
  117. package/esm/series-998e2084.js +0 -1
  118. package/esm/series-v2-0727ee8c.js +0 -1
  119. package/esm/series-v2-9bcd5d54.js +0 -1
  120. package/esm/settings-icon-0125bffd.js +0 -1
  121. package/esm/settings-icon-9bac9ef3.js +0 -1
  122. package/esm/skin-0aea7a56.js +0 -1
  123. package/esm/skin-2c638dc1.js +0 -1
  124. package/esm/skin-5a02ebe6.js +0 -1
  125. package/esm/skin-665ec17e.js +0 -1
  126. package/esm/skin-80957fd8.js +0 -1
  127. package/esm/skin-851ea2fb.js +0 -1
  128. package/esm/skin-bb73c15b.js +0 -1
  129. package/esm/skin-cd537931.js +0 -1
  130. package/esm/skin-d5510f70.js +0 -1
  131. package/esm/skin-fba79111.js +0 -1
  132. package/esm/util-9c9ee6b3.js +0 -1
  133. package/esm/videoSelector-8da87dd3.js +0 -1
  134. package/esm/videoSelector-8e258d45.js +0 -1
@@ -0,0 +1,335 @@
1
+ import VideoPlayerUI from './player-ui/player-ui.js';
2
+ import { vtt_or_srt_parser } from './utilities/utilities.js';
3
+ import "./styles/index.css";
4
+
5
+ class SmartTVVideoPlayer {
6
+ constructor(parentContainerId, playerId, config) {
7
+ this.mountPoint = document.createElement('div');
8
+ this.mountPoint.id = playerId;
9
+ this.mountPoint.className = "vl-player-container";
10
+ this.mountPoint.style.width = '100%';
11
+ this.mountPoint.style.height = '100%';
12
+ this.mountPoint.style.position = 'absolute';
13
+ this.mountPoint.style.top = '0';
14
+ this.mountPoint.style.left = '0';
15
+
16
+ if(this.parentContainerId){
17
+ this.parentContainer = document.getElementById(parentContainerId);
18
+ this.parentContainer.appendChild(this.mountPoint);
19
+ } else {
20
+ document.body.appendChild(this.mountPoint);
21
+ }
22
+
23
+
24
+ this.config = config;
25
+ this.hls = null;
26
+ this.dashjs = null;
27
+ this.closedCaptions = config.closedCaptions || [];
28
+ this.enableTrack = config.enableTrack || false;
29
+
30
+ this.captionsOptionsList = [];
31
+ this.videoResolutionsList = [];
32
+ this.audioList = [];
33
+
34
+ this.video = document.createElement('video');
35
+ this.video.style.position = "absolute";
36
+ this.track = document.createElement('ttml-rendering-div');
37
+ this.video.appendChild(this.track);
38
+
39
+ this.initializePlayer();
40
+ }
41
+
42
+ getCaptionsOptions() {
43
+ return this.captionsOptionsList;
44
+ }
45
+
46
+ getVideoResolutions() {
47
+ return this.videoResolutionsList;
48
+ }
49
+
50
+ getAudioTracks() {
51
+ return this.audioList;
52
+ }
53
+
54
+ initializePlayer() {
55
+ const streamUrl = this.config.streamUrl || '';
56
+ if (!streamUrl) {
57
+ throw new Error('Stream URL is required to create HLS player');
58
+ }
59
+
60
+ this.video.controls = false;
61
+ this.video.style.width = '100%';
62
+ this.video.style.height = '100%';
63
+
64
+ this.addPlayerEventListeners();
65
+
66
+ if(this.config.drmEnabled){
67
+ this.dashjs = window.dashjs.MediaPlayer().create();
68
+
69
+ const widevine = this.config.drmMetadata.widevine;
70
+ const playReady= this.config.drmMetadata.playReady;
71
+
72
+ let protectionData = {
73
+ "com.widevine.alpha": {
74
+ serverURL: widevine.licenseUrl,
75
+ httpRequestHeaders: {
76
+ "X-AxDRM-Message": widevine.licenseToken
77
+ }
78
+ },
79
+ "com.microsoft.playready": {
80
+ serverURL: playReady.licenseUrl,
81
+ httpRequestHeaders: {
82
+ "X-AxDRM-Message": playReady.licenseToken,
83
+ }
84
+ }
85
+ }
86
+
87
+ this.dashjs.initialize(this.video, widevine.url, true);
88
+ this.dashjs.attachTTMLRenderingDiv(this.track);
89
+ this.dashjs.attachView(this.video);
90
+ this.dashjs.setProtectionData(protectionData);
91
+ this.dashjs.preload();
92
+
93
+ } else if (window.Hls && window.Hls.isSupported()) {
94
+ const hlsConfig = {
95
+ "enableWorker": true,
96
+ "lowLatencyMode": true,
97
+ "backBufferLength": 90,
98
+ "maxBufferLength": 12,
99
+ "maxMaxBufferLength": 15,
100
+ "maxFragLookUpTolerance": 0.25,
101
+ "maxLoadingDelay": 4
102
+ };
103
+
104
+ this.hls = new window.Hls(hlsConfig);
105
+ this.hls.loadSource(streamUrl);
106
+ this.hls.attachMedia(this.video);
107
+
108
+
109
+ } else if (this.video.canPlayType('application/vnd.apple.mpegurl')) {
110
+ this.video.src = streamUrl;
111
+ this.video.addEventListener('loadedmetadata', () => {
112
+ this.video.play();
113
+ });
114
+ } else {
115
+ throw new Error('HLS is not supported in this browser.');
116
+ }
117
+
118
+ if (this.config.drmEnabled) {
119
+ this.dashjs.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED, () => {
120
+ this.videoResolutionsList = this.dashjs.getBitrateInfoListFor('video');
121
+ this.audioList = this.dashjs.getTracksFor('audio');
122
+ this.captionsoptionsList = this.dashjs.getTracksFor('text');
123
+
124
+
125
+ this.player = {
126
+ video: this.video,
127
+ play: () => this.video.play(),
128
+ pause: () => this.video.pause(),
129
+ captionsOptions: () => this.getCaptionsOptions(),
130
+ videoResolutions: () => this.getVideoResolutions(),
131
+ audioTracks: () => this.getAudioTracks(),
132
+ playerInstance: this.dashjs
133
+ };
134
+
135
+ this.ui = new VideoPlayerUI({
136
+ player: this.player,
137
+ config: this.config
138
+ });
139
+ this.ui.attachTo(this.mountPoint);
140
+ });
141
+ } else {
142
+ this.hls.on(window.Hls.Events.AUDIO_TRACKS_UPDATED, () => {
143
+ this.audioList = this.hls.audioTracks;
144
+ });
145
+
146
+ this.hls.on(window.Hls.Events.MANIFEST_PARSED, () => {
147
+ this.videoResolutionsList = this.hls.levels;
148
+
149
+ this.player = {
150
+ video: this.video,
151
+ play: () => this.video.play(),
152
+ pause: () => this.video.pause(),
153
+ captionsOptions: () => this.getCaptionsOptions(),
154
+ videoResolutions: () => this.getVideoResolutions(),
155
+ audioTracks: () => this.getAudioTracks(),
156
+ playerInstance: this.hls
157
+ };
158
+
159
+ this.ui = new VideoPlayerUI({
160
+ player: this.player,
161
+ config: this.config
162
+ });
163
+ this.ui.attachTo(this.mountPoint);
164
+ });
165
+ }
166
+ }
167
+ addPlayerEventListeners() {
168
+ if (!this.video) return;
169
+ this.video.addEventListener("loadedmetadata", this.onVideoLoad);
170
+ this.video.addEventListener("canplaythrough", this.canplaythrough.bind(this));
171
+ this.video.addEventListener("ended", this.onPlayebackEnded);
172
+ this.video.addEventListener("timeupdate", this.playbackprogress);
173
+ this.video.addEventListener("playing", this.onPlaying);
174
+ this.video.addEventListener("error", this.onError);
175
+ this.video.addEventListener("waiting", this.onBuffering);
176
+ this.video.addEventListener("play", this.onPlay);
177
+ this.video.addEventListener("seeked", this.onSeeked);
178
+ this.video.addEventListener("stalled", this.onStalled);
179
+ }
180
+
181
+ removePlayerEventListeners() {
182
+ if (!this.video) return;
183
+ this.video.removeEventListener("loadedmetadata", this.onVideoLoad);
184
+ this.video.removeEventListener("ended", this.onPlayebackEnded);
185
+ this.video.removeEventListener("timeupdate", this.playbackprogress);
186
+ this.video.removeEventListener("playing", this.onPlaying);
187
+ this.video.removeEventListener("error", this.onError);
188
+ this.video.removeEventListener("waiting", this.onBuffering);
189
+ this.video.removeEventListener("play", this.onPlay);
190
+ this.video.removeEventListener("canplaythrough", this.canplaythrough.bind(this));
191
+ this.video.removeEventListener("seeked", this.onSeeked);
192
+ this.video.removeEventListener("stalled", this.onStalled);
193
+ }
194
+
195
+ canplaythrough() {
196
+ if(this.captionsOptionsList.length <= 0) {
197
+ this.addAllCaptionsToPlayer(0);
198
+
199
+ let allCCTracks = this.video.textTracks;
200
+
201
+ if (allCCTracks != undefined && allCCTracks.length > 0) {
202
+ for (let i = 0; i < allCCTracks.length; i++) {
203
+ if (allCCTracks[i].kind.toLowerCase() == "captions" || allCCTracks[i].kind.toLowerCase() == "subtitles" || allCCTracks[i].kind.toLowerCase() == "caption" || allCCTracks[i].kind.toLowerCase() == "subtitle") {
204
+ this.captionsOptionsList.push(allCCTracks[i]);
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ console.log("TEXT TRACKS:", this.captionsOptionsList);
211
+ console.log("VIDEO RESOLUTION:", this.videoResolutionsList);
212
+ console.log("AUDIO TRACKS:", this.audioList);
213
+ }
214
+
215
+ addAllCaptionsToPlayer(counterVariable) {
216
+ if (counterVariable >= this.closedCaptions.length) return;
217
+
218
+ const currentLabel = this.closedCaptions[counterVariable].language;
219
+
220
+ fetch(this.closedCaptions[counterVariable].url)
221
+ .then(response => response.json())
222
+ .then(data => {
223
+ if (data.hasOwnProperty("type")) {
224
+ if (data["type"] === "failure") {
225
+ this.addAllCaptionsToPlayer(counterVariable + 1);
226
+ }
227
+ } else {
228
+ const vttObj = {
229
+ data: data,
230
+ label: currentLabel,
231
+ lang: currentLabel,
232
+ };
233
+ this.addCaptionToPlayer(vttObj);
234
+ this.addAllCaptionsToPlayer(counterVariable + 1);
235
+ }
236
+ })
237
+ .catch(error => {
238
+ this.addAllCaptionsToPlayer(counterVariable + 1);
239
+ });
240
+ }
241
+
242
+ addCaptionToPlayer(vttObj) {
243
+ const track = this.player?.video?.addTextTrack('captions', vttObj.label, vttObj.lang);
244
+ if (track) track.mode = "hidden";
245
+ vtt_or_srt_parser(vttObj.data).map(cue => {
246
+ if (track) track.addCue(cue);
247
+ });
248
+ }
249
+
250
+ toggleCaptions() {
251
+ try {
252
+ if (!this.video) return;
253
+
254
+ const allCCTracks = this.video.textTracks;
255
+
256
+ if (allCCTracks && allCCTracks.length > 0) {
257
+ for (let i = 0; i < allCCTracks.length; i++) {
258
+ const track = allCCTracks[i];
259
+ const kind = track.kind?.toLowerCase();
260
+
261
+ if (['captions', 'subtitles', 'caption', 'subtitle'].includes(kind)) {
262
+ if (this.enableTrack) {
263
+ track.mode = "hidden";
264
+ } else {
265
+ if (track.cues?.length > 0) {
266
+ track.mode = "showing";
267
+ break; // Show first valid track only
268
+ } else {
269
+ track.mode = "disabled";
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ } catch (error) {
276
+ console.error("Error managing captions:", error);
277
+ }
278
+
279
+ if (this.track) {
280
+ this.track.style.display = this.enableTrack ? "none" : "flex";
281
+ }
282
+ }
283
+
284
+
285
+ onVideoLoad() {
286
+ console.log('Video metadata loaded');
287
+ }
288
+
289
+ onPlayebackEnded() {
290
+ console.log('Playback ended');
291
+ }
292
+
293
+ playbackprogress() {
294
+ console.log('Playback progress updated');
295
+ }
296
+
297
+ onPlaying() {
298
+ console.log('Video is playing');
299
+ }
300
+
301
+ onError(event) {
302
+ console.error('Video error:', event);
303
+ }
304
+
305
+ onBuffering() {
306
+ console.log('Video is buffering');
307
+ }
308
+
309
+ onPlay() {
310
+ console.log('Video started playing');
311
+ }
312
+
313
+ onSeeked() {
314
+ console.log('Video seeked');
315
+ }
316
+
317
+ onStalled() {
318
+ console.log('Video stalled');
319
+ }
320
+
321
+ unmount(){
322
+ this.mountPoint.remove();
323
+ this.mountPoint = undefined;
324
+ }
325
+ }
326
+
327
+ export function createHlsPlayer(parentContainerId, playerId, config) {
328
+ if (!playerId) {
329
+ throw new Error('playerId must be a valid id');
330
+ }
331
+ if (!config || typeof config !== 'object') {
332
+ throw new Error('Config must be a valid object');
333
+ }
334
+ return new SmartTVVideoPlayer(parentContainerId, playerId, config);
335
+ }
@@ -0,0 +1,204 @@
1
+ /*************** playerSeekbar.css ***************/
2
+ body {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ background-color: #000;
7
+ }
8
+ .vl-player-container .seekbar-container {
9
+ position: absolute;
10
+ left: 50%;
11
+ transform: translateX(-50%);
12
+ bottom: 50px;
13
+ height: 12px;
14
+ background: #444;
15
+ width: 90%;
16
+ cursor: pointer;
17
+ border-radius: 6px;
18
+ margin: 0;
19
+ user-select: none;
20
+ z-index: 20;
21
+ }
22
+
23
+ .vl-player-container .seekbar-buffer {
24
+ position: absolute;
25
+ height: 100%;
26
+ background: #888;
27
+ width: 0;
28
+ border-radius: 6px;
29
+ z-index: 1;
30
+ }
31
+
32
+ .vl-player-container .seekbar-progress {
33
+ position: absolute;
34
+ height: 100%;
35
+ background: rgba(254, 253, 255, 0.7);
36
+ width: 0;
37
+ border-radius: 6px;
38
+ z-index: 2;
39
+ transition: width 0.1s linear;
40
+ }
41
+
42
+ .vl-player-container .seekbar-thumb {
43
+ position: absolute;
44
+ top: 50%;
45
+ transform: translate(-50%, -50%);
46
+ width: 16px;
47
+ height: 16px;
48
+ background: #fff;
49
+ border-radius: 50%;
50
+ /* border: 2px solid #4169E1; */
51
+ z-index: 3;
52
+ box-shadow: 0 2px 8px rgba(0,0,0,0.2);
53
+ cursor: pointer;
54
+ transition: background 0.2s;
55
+ }
56
+ .vl-player-container .seekbar-thumb:hover {
57
+ background: #ffeaea;
58
+ }
59
+
60
+ .vl-player-container .seekbar-tooltip {
61
+ position: absolute;
62
+ bottom: 24px;
63
+ left: 0;
64
+ transform: translateX(-50%);
65
+ background: #222;
66
+ color: #fff;
67
+ padding: 2px 8px;
68
+ border-radius: 4px;
69
+ font-size: 12px;
70
+ white-space: nowrap;
71
+ pointer-events: none;
72
+ z-index: 10;
73
+ }
74
+
75
+ .vl-player-container .seekbar-time-label, .vl-player-container .seekbar-duration-label {
76
+ position: relative;
77
+ top: 18px;
78
+ font-size: 13px;
79
+ color: #eee;
80
+ margin-right: 4px;
81
+ z-index: 5;
82
+ }
83
+
84
+
85
+
86
+
87
+ /*************** playerButtons.css ***************/
88
+
89
+ .vl-player-container .play-pause-btn {
90
+ position: absolute !important;
91
+ left: 50%;
92
+ top: 50%;
93
+ transform: translate(-50%, -50%);
94
+ z-index: 20;
95
+ width: 70px;
96
+ height: 70px;
97
+ border-radius: 50%;
98
+ background: rgba(255,255,255, .5);
99
+ cursor: pointer;
100
+ }
101
+
102
+ .vl-player-container .play-pause-btn img {
103
+ position: absolute !important;
104
+ left: 50%;
105
+ top: 50%;
106
+ transform: translate(-50%, -50%);
107
+ height: 50px;
108
+ }
109
+
110
+
111
+ .vl-player-container .left-side-container {
112
+ position: absolute !important;
113
+ display: flex;
114
+ left: 5%;
115
+ bottom: 77px;
116
+ }
117
+
118
+ .vl-player-container .right-side-container {
119
+ position: absolute !important;
120
+ display: flex;
121
+ right: 5%;
122
+ bottom: 77px;
123
+ }
124
+
125
+ .vl-player-container .settings-btn {
126
+ border-radius: 5px;
127
+ padding: 5px;
128
+ bottom: 100px;
129
+ width: 50px;
130
+ height: 40px;
131
+ margin: 0 5px;
132
+ background: rgba(255,255,255, 0.5);
133
+ cursor: pointer;
134
+ z-index: 20;
135
+ }
136
+
137
+ .vl-player-container .settings-btn img{
138
+ height: 100%;
139
+ }
140
+
141
+ .vl-player-container .restart-btn {
142
+ right: 2%;
143
+ border-radius: 8px;
144
+ padding: 5px;
145
+ bottom: 100px;
146
+ border: 2px solid #fff;
147
+ color: #fff;
148
+ font-size: 20px;
149
+ font-weight: 700;
150
+ display: flex;
151
+ flex-direction: column;
152
+ justify-content: center;
153
+ margin: 0 5px;
154
+ cursor: pointer;
155
+ z-index: 20;
156
+ }
157
+
158
+
159
+ /*************** player-setting-option-wrapper ***************/
160
+ .vl-player-container .default-option-wrapper {
161
+ display: flex;
162
+ justify-content: space-between;
163
+ align-items: center;
164
+ width: 95%;
165
+ height: 50px;
166
+ background: #525760;
167
+ color: #fff;
168
+ padding: 5px 10px;
169
+ font-weight: 700;
170
+ font-size: 18px;
171
+ border-radius: 2px;
172
+ box-shadow: 0 10px 15px rgba(0, 0, 0, .1);
173
+ margin: 20px 0px;
174
+ text-transform: capitalize;
175
+ cursor: pointer;
176
+ }
177
+ .vl-player-container .default-option-wrapper span {
178
+ height: 40px;
179
+ }
180
+
181
+ .vl-player-container .default-option-wrapper span > img{
182
+ height: 100%;
183
+ }
184
+
185
+
186
+ .vl-player-container .default-sidebar {
187
+ position: absolute;
188
+ top: 0;
189
+ color: #fff;
190
+ display: flex;
191
+ flex-direction: column;
192
+ background-color: rgba(30, 30, 30, .75);
193
+ height: 100%;
194
+ min-height: 720px;
195
+ width: 400px;
196
+ padding: 50px 20px 0 20px;
197
+ right: 0px;
198
+ z-index: 30;
199
+ /* right: -450px; */
200
+ }
201
+
202
+ .vl-player-container .focused{
203
+ outline: 2px solid #ffffff;
204
+ }
@@ -0,0 +1,79 @@
1
+ export const vtt_or_srt_parser = (vtt) => {
2
+
3
+ try {
4
+ var lines = vtt.trim().split(/[\r\n\r\n]/).map(function (line) {
5
+ return line.trim();
6
+ });
7
+ } catch (e) {
8
+ try {
9
+ var lines = vtt.message.split(/[\r\n\r\n]/).map(function (line) {
10
+ return line.trim();
11
+ });
12
+ } catch (e) {
13
+ return [];
14
+ }
15
+
16
+ }
17
+ var cues = [];
18
+ var start = null;
19
+ var end = null;
20
+ var payload = null;
21
+ for (var i = 0; i < lines.length; i++) {
22
+
23
+ if (lines[i].indexOf('-->') >= 0) {
24
+ var splitted = lines[i].split(/[ \t]+-->[ \t]+/);
25
+ if (splitted.length != 2) {
26
+ throw 'Error when splitting "-->": ' + lines[i];
27
+ }
28
+ if (start != null && end != null && payload != null) {
29
+ var cue = new VTTCue(start, end, payload);
30
+ cue.line = 13;
31
+ cues.push(cue);
32
+ }
33
+
34
+ payload = null;
35
+ start = null;
36
+ end = null;
37
+
38
+ // Already ignoring anything past the "end" timestamp (i.e. cue settings).
39
+ if (splitted[0] && splitted[1] && splitted[0].indexOf("undefined") == -1 && splitted[1].indexOf("undefined") == -1) {
40
+ start = parse_timestamp(splitted[0]);
41
+ end = parse_timestamp(splitted[1]);
42
+ }
43
+ } else if (lines[i] != undefined && lines[i].trim() != '') {
44
+ try {
45
+ if (Number(lines[i]) > 0) {
46
+
47
+ } else {
48
+ payload = (payload == null) ? "" : payload;
49
+ payload = ((payload.trim() == "") ? lines[i] : (payload + '\n' + lines[i]));
50
+ }
51
+
52
+ } catch (e) {
53
+ payload = (payload == null) ? "" : payload;
54
+ payload = ((payload.trim() == "") ? lines[i] : (payload + '\n' + lines[i]));
55
+ }
56
+
57
+ }
58
+
59
+
60
+ }
61
+ if (start && end && payload) {
62
+ var cue = new VTTCue(start, end, payload);
63
+ cue.line = 13;
64
+ cues.push(cue);
65
+ }
66
+
67
+ return cues;
68
+ }
69
+
70
+ export const parse_timestamp = (s) => {
71
+ let match = s.match(/^(?:([0-9]+):)?([0-5][0-9]):([0-5][0-9](?:[.,][0-9]{0,3})?)/);
72
+ if (match == null) {
73
+ throw 'Invalid timestamp format: ' + s;
74
+ }
75
+ let hours = parseInt(match[1] || "0", 10);
76
+ let minutes = parseInt(match[2], 10);
77
+ let seconds = parseFloat(match[3].replace(',', '.'));
78
+ return seconds + 60 * minutes + 60 * 60 * hours;
79
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES5",
4
+ "module": "ESNext",
5
+ "declaration": true,
6
+ "noImplicitAny": false,
7
+ "outDir": "dist",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "moduleResolution": "node",
11
+ "skipLibCheck": true,
12
+ "lib": ["dom", "es2017"]
13
+ },
14
+ "include": ["src/**/*"]
15
+ }
@@ -1 +0,0 @@
1
- "use strict";var e,t=require("./generic-81b1be69.js"),i=require("./util-ce8a4138.js"),o=require("./skin-84083352.js"),n=0,d=0,u=function e(i,n,u,s,c){d=i,i>u.length-1||t.load(n,u[i].id,s).then((function(e){o.highlightVideo(d),d++,t.setVideoIdx(d),r(e)})).catch((function(i){r(i),setTimeout((function(){o.highlightVideo(d),d++,t.setVideoIdx(d),e(d,n,u,s)}),5e3)}))},r=function(t){e&&e(t)};exports.autoPlayNext=function(s){clearTimeout(n);var c=null==s?void 0:s.content;e=null==s?void 0:s.cb;var h=s.playerId,l=sessionStorage.getItem("token");i.onVideoEnded(h,(function(){var e=t.getPlayer(h);0!==(null==e?void 0:e.currentTime())&&((d=t.getVideoIdx())>c.length-1||t.load(h,c[d].id,l).then((function(e){o.highlightVideo(d),t.setCurrentVideo(e.response),d++,t.setVideoIdx(d),r(e)})).catch((function(e){r(e),o.highlightVideo(d),d++,t.setVideoIdx(d),n=setTimeout((function(){t.isPaused(h)&&u(d,h,c,l)}),5e3)})))}))},exports.switchToNext=u;