myetv-player 1.0.10 → 1.1.0

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.
@@ -309,3 +309,56 @@
309
309
  touch-action: none; // Disable browser's default touch gestures
310
310
  -webkit-touch-callout: none; // Disable callout on iOS
311
311
  }
312
+
313
+ // ===================================
314
+ // ENCODING BADGE - Video in encoding
315
+ // ===================================
316
+
317
+ /* Badge for video in encoding (duration Infinity/NaN) */
318
+ .encoding-badge {
319
+ display: inline-block;
320
+ background: rgba(128, 128, 128, 0.8); // Grigio semi-trasparente
321
+ color: white;
322
+ padding: 2px 8px;
323
+ border-radius: 4px;
324
+ font-size: 11px;
325
+ font-weight: 500;
326
+ text-transform: uppercase;
327
+ letter-spacing: 0.5px;
328
+ white-space: nowrap;
329
+ backdrop-filter: blur(4px);
330
+ border: 1px solid rgba(255, 255, 255, 0.2);
331
+ animation: encoding-pulse 2s ease-in-out infinite;
332
+ }
333
+
334
+ /* Class for the container when shows the badge */
335
+ .time-display .encoding-state {
336
+ display: flex;
337
+ align-items: center;
338
+ }
339
+
340
+ /* animation for the badge */
341
+ @keyframes encoding-pulse {
342
+ 0%, 100% {
343
+ opacity: 0.8;
344
+ }
345
+
346
+ 50% {
347
+ opacity: 1;
348
+ }
349
+ }
350
+
351
+ // Responsive for badge encoding
352
+ @media (max-width: 480px) {
353
+ .encoding-badge {
354
+ font-size: 9px;
355
+ padding: 1px 6px;
356
+ }
357
+ }
358
+
359
+ @media (max-width: 350px) {
360
+ .encoding-badge {
361
+ font-size: 8px;
362
+ padding: 1px 4px;
363
+ }
364
+ }
@@ -44,6 +44,33 @@
44
44
  -moz-osx-font-smoothing: grayscale;
45
45
  }
46
46
 
47
+ .subtitle-text {
48
+ color: var(--player-text-color);
49
+ font-size: 14px; // Più piccolo del titolo (18px)
50
+ font-weight: 400; // Più leggero del titolo (600)
51
+ line-height: 1.3;
52
+ margin: 5px 0 0 0;
53
+ white-space: nowrap;
54
+ overflow: hidden;
55
+ text-overflow: ellipsis;
56
+ text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
57
+ opacity: 0.9;
58
+ -webkit-font-smoothing: antialiased;
59
+ -moz-osx-font-smoothing: grayscale;
60
+ }
61
+
62
+ @media (max-width: 768px) {
63
+ .subtitle-text {
64
+ font-size: 12px;
65
+ }
66
+ }
67
+
68
+ @media (max-width: 480px) {
69
+ .subtitle-text {
70
+ font-size: 11px;
71
+ }
72
+ }
73
+
47
74
  /* CONTROLS - IMPROVED RESPONSIVE DESIGN */
48
75
  .controls {
49
76
  position: absolute;
package/src/core.js CHANGED
@@ -26,6 +26,7 @@ constructor(videoElement, options = {}) {
26
26
  showSeekTooltip: true,
27
27
  showTitleOverlay: false,
28
28
  videoTitle: '',
29
+ videoSubtitle: '',
29
30
  persistentTitle: false,
30
31
  debug: false, // Enable/disable debug logging
31
32
  autoplay: false, // if video should autoplay at start
@@ -582,9 +583,16 @@ createTitleOverlay() {
582
583
  const titleText = document.createElement('h2');
583
584
  titleText.className = 'title-text';
584
585
  titleText.textContent = this.options.videoTitle || '';
585
-
586
586
  overlay.appendChild(titleText);
587
587
 
588
+ // add subtitles
589
+ if (this.options.videoSubtitle) {
590
+ const subtitleText = document.createElement('p');
591
+ subtitleText.className = 'subtitle-text';
592
+ subtitleText.textContent = this.options.videoSubtitle;
593
+ overlay.appendChild(subtitleText);
594
+ }
595
+
588
596
  if (this.controls) {
589
597
  this.container.insertBefore(overlay, this.controls);
590
598
  } else {
@@ -658,6 +666,31 @@ getVideoTitle() {
658
666
  return this.options.videoTitle;
659
667
  }
660
668
 
669
+ setVideoSubtitle(subtitle) {
670
+ this.options.videoSubtitle = subtitle || '';
671
+
672
+ if (this.titleOverlay) {
673
+ let subtitleElement = this.titleOverlay.querySelector('.subtitle-text');
674
+
675
+ if (subtitle) {
676
+ if (!subtitleElement) {
677
+ subtitleElement = document.createElement('p');
678
+ subtitleElement.className = 'subtitle-text';
679
+ this.titleOverlay.appendChild(subtitleElement);
680
+ }
681
+ subtitleElement.textContent = subtitle;
682
+ } else if (subtitleElement) {
683
+ subtitleElement.remove();
684
+ }
685
+ }
686
+
687
+ return this;
688
+ }
689
+
690
+ getVideoSubtitle() {
691
+ return this.options.videoSubtitle;
692
+ }
693
+
661
694
  setPersistentTitle(persistent) {
662
695
  this.options.persistentTitle = persistent;
663
696
 
package/src/utils.js CHANGED
@@ -24,15 +24,29 @@
24
24
  this.video.currentTime = Math.max(0, Math.min(this.video.duration, this.video.currentTime + seconds));
25
25
  }
26
26
 
27
- updateTimeDisplay() {
28
- if (this.currentTimeEl && this.video) {
29
- this.currentTimeEl.textContent = this.formatTime(this.video.currentTime || 0);
30
- }
27
+ updateTimeDisplay() {
28
+ // update current time
29
+ if (this.currentTimeEl && this.video) {
30
+ this.currentTimeEl.textContent = this.formatTime(this.video.currentTime || 0);
31
+ }
31
32
 
32
- if (this.durationEl && this.video && this.video.duration && !isNaN(this.video.duration)) {
33
- this.durationEl.textContent = this.formatTime(this.video.duration);
33
+ // update duration or show badge if encoding
34
+ if (this.durationEl && this.video) {
35
+ const duration = this.video.duration;
36
+
37
+ // check if duration is valid
38
+ if (!duration || isNaN(duration) || !isFinite(duration)) {
39
+ // Video in encoding - show badge instead of duration
40
+ this.durationEl.innerHTML = '<span class="encoding-badge">Encoding in progress</span>';
41
+ this.durationEl.classList.add('encoding-state');
42
+ } else {
43
+ // valid duration - show normal
44
+ this.durationEl.textContent = this.formatTime(duration);
45
+ this.durationEl.classList.remove('encoding-state');
34
46
  }
35
47
  }
48
+ }
49
+
36
50
 
37
51
  formatTime(seconds) {
38
52
  if (isNaN(seconds) || seconds < 0) return '0:00';