vidply 1.0.3 → 1.0.5
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 +100 -24
- package/dist/vidply.css +24 -0
- package/dist/vidply.esm.js +448 -212
- package/dist/vidply.esm.js.map +3 -3
- package/dist/vidply.esm.min.js +7 -6
- package/dist/vidply.esm.min.meta.json +31 -25
- package/dist/vidply.js +448 -212
- package/dist/vidply.js.map +3 -3
- package/dist/vidply.min.css +1 -1
- package/dist/vidply.min.js +7 -6
- package/dist/vidply.min.meta.json +31 -25
- package/package.json +4 -1
- package/src/controls/ControlBar.js +45 -7
- package/src/core/Player.js +36 -0
- package/src/features/PlaylistManager.js +611 -437
- package/src/i18n/translations.js +50 -0
- package/src/styles/vidply.css +24 -0
- package/src/utils/TimeUtils.js +9 -4
|
@@ -10,18 +10,8 @@
|
|
|
10
10
|
"imports": [],
|
|
11
11
|
"format": "esm"
|
|
12
12
|
},
|
|
13
|
-
"src/utils/TimeUtils.js": {
|
|
14
|
-
"bytes": 1940,
|
|
15
|
-
"imports": [],
|
|
16
|
-
"format": "esm"
|
|
17
|
-
},
|
|
18
|
-
"src/icons/Icons.js": {
|
|
19
|
-
"bytes": 12356,
|
|
20
|
-
"imports": [],
|
|
21
|
-
"format": "esm"
|
|
22
|
-
},
|
|
23
13
|
"src/i18n/translations.js": {
|
|
24
|
-
"bytes":
|
|
14
|
+
"bytes": 16450,
|
|
25
15
|
"imports": [],
|
|
26
16
|
"format": "esm"
|
|
27
17
|
},
|
|
@@ -36,8 +26,24 @@
|
|
|
36
26
|
],
|
|
37
27
|
"format": "esm"
|
|
38
28
|
},
|
|
29
|
+
"src/utils/TimeUtils.js": {
|
|
30
|
+
"bytes": 2155,
|
|
31
|
+
"imports": [
|
|
32
|
+
{
|
|
33
|
+
"path": "src/i18n/i18n.js",
|
|
34
|
+
"kind": "import-statement",
|
|
35
|
+
"original": "../i18n/i18n.js"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"format": "esm"
|
|
39
|
+
},
|
|
40
|
+
"src/icons/Icons.js": {
|
|
41
|
+
"bytes": 12356,
|
|
42
|
+
"imports": [],
|
|
43
|
+
"format": "esm"
|
|
44
|
+
},
|
|
39
45
|
"src/controls/ControlBar.js": {
|
|
40
|
-
"bytes":
|
|
46
|
+
"bytes": 74720,
|
|
41
47
|
"imports": [
|
|
42
48
|
{
|
|
43
49
|
"path": "src/utils/DOMUtils.js",
|
|
@@ -136,7 +142,7 @@
|
|
|
136
142
|
"format": "esm"
|
|
137
143
|
},
|
|
138
144
|
"src/core/Player.js": {
|
|
139
|
-
"bytes":
|
|
145
|
+
"bytes": 35845,
|
|
140
146
|
"imports": [
|
|
141
147
|
{
|
|
142
148
|
"path": "src/utils/EventEmitter.js",
|
|
@@ -202,7 +208,7 @@
|
|
|
202
208
|
"format": "esm"
|
|
203
209
|
},
|
|
204
210
|
"src/features/PlaylistManager.js": {
|
|
205
|
-
"bytes":
|
|
211
|
+
"bytes": 17043,
|
|
206
212
|
"imports": [
|
|
207
213
|
{
|
|
208
214
|
"path": "src/utils/DOMUtils.js",
|
|
@@ -252,20 +258,20 @@
|
|
|
252
258
|
"src/utils/DOMUtils.js": {
|
|
253
259
|
"bytesInOutput": 1581
|
|
254
260
|
},
|
|
255
|
-
"src/utils/TimeUtils.js": {
|
|
256
|
-
"bytesInOutput": 728
|
|
257
|
-
},
|
|
258
|
-
"src/icons/Icons.js": {
|
|
259
|
-
"bytesInOutput": 10407
|
|
260
|
-
},
|
|
261
261
|
"src/i18n/translations.js": {
|
|
262
|
-
"bytesInOutput":
|
|
262
|
+
"bytesInOutput": 13713
|
|
263
263
|
},
|
|
264
264
|
"src/i18n/i18n.js": {
|
|
265
265
|
"bytesInOutput": 720
|
|
266
266
|
},
|
|
267
|
+
"src/utils/TimeUtils.js": {
|
|
268
|
+
"bytesInOutput": 839
|
|
269
|
+
},
|
|
270
|
+
"src/icons/Icons.js": {
|
|
271
|
+
"bytesInOutput": 10407
|
|
272
|
+
},
|
|
267
273
|
"src/controls/ControlBar.js": {
|
|
268
|
-
"bytesInOutput":
|
|
274
|
+
"bytesInOutput": 36374
|
|
269
275
|
},
|
|
270
276
|
"src/controls/CaptionManager.js": {
|
|
271
277
|
"bytesInOutput": 3599
|
|
@@ -277,7 +283,7 @@
|
|
|
277
283
|
"bytesInOutput": 12461
|
|
278
284
|
},
|
|
279
285
|
"src/core/Player.js": {
|
|
280
|
-
"bytesInOutput":
|
|
286
|
+
"bytesInOutput": 16746
|
|
281
287
|
},
|
|
282
288
|
"src/renderers/YouTubeRenderer.js": {
|
|
283
289
|
"bytesInOutput": 4140
|
|
@@ -289,10 +295,10 @@
|
|
|
289
295
|
"bytesInOutput": 5386
|
|
290
296
|
},
|
|
291
297
|
"src/features/PlaylistManager.js": {
|
|
292
|
-
"bytesInOutput":
|
|
298
|
+
"bytesInOutput": 8100
|
|
293
299
|
}
|
|
294
300
|
},
|
|
295
|
-
"bytes":
|
|
301
|
+
"bytes": 128795
|
|
296
302
|
}
|
|
297
303
|
}
|
|
298
304
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vidply",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Universal, accessible video & audio player with ES6 modules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/vidply.js",
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
"email": "vidply@mpeltzer.de"
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://matthiaspeltzer.github.io/vidply/",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"esbuild": "^0.25.10",
|
|
51
54
|
"clean-css": "^5.3.3"
|
|
@@ -698,13 +698,30 @@ export class ControlBar {
|
|
|
698
698
|
|
|
699
699
|
createTimeDisplay() {
|
|
700
700
|
const container = DOMUtils.createElement('div', {
|
|
701
|
-
className: `${this.player.options.classPrefix}-time
|
|
701
|
+
className: `${this.player.options.classPrefix}-time`,
|
|
702
|
+
attributes: {
|
|
703
|
+
'role': 'group',
|
|
704
|
+
'aria-label': i18n.t('time.display')
|
|
705
|
+
}
|
|
702
706
|
});
|
|
703
707
|
|
|
708
|
+
// Current time - visual text hidden, only aria-label announced
|
|
704
709
|
this.controls.currentTimeDisplay = DOMUtils.createElement('span', {
|
|
705
710
|
className: `${this.player.options.classPrefix}-current-time`,
|
|
706
|
-
|
|
711
|
+
attributes: {
|
|
712
|
+
'aria-label': i18n.t('time.seconds', { count: 0 })
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
// Create visual text inside, hidden from screen readers
|
|
717
|
+
const currentTimeVisual = DOMUtils.createElement('span', {
|
|
718
|
+
textContent: '00:00',
|
|
719
|
+
attributes: {
|
|
720
|
+
'aria-hidden': 'true'
|
|
721
|
+
}
|
|
707
722
|
});
|
|
723
|
+
this.controls.currentTimeDisplay.appendChild(currentTimeVisual);
|
|
724
|
+
this.controls.currentTimeVisual = currentTimeVisual;
|
|
708
725
|
|
|
709
726
|
const separator = DOMUtils.createElement('span', {
|
|
710
727
|
textContent: ' / ',
|
|
@@ -713,10 +730,23 @@ export class ControlBar {
|
|
|
713
730
|
}
|
|
714
731
|
});
|
|
715
732
|
|
|
733
|
+
// Duration - visual text hidden, only aria-label announced
|
|
716
734
|
this.controls.durationDisplay = DOMUtils.createElement('span', {
|
|
717
735
|
className: `${this.player.options.classPrefix}-duration`,
|
|
718
|
-
|
|
736
|
+
attributes: {
|
|
737
|
+
'aria-label': i18n.t('time.durationPrefix') + i18n.t('time.seconds', { count: 0 })
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// Create visual text inside, hidden from screen readers
|
|
742
|
+
const durationVisual = DOMUtils.createElement('span', {
|
|
743
|
+
textContent: '00:00',
|
|
744
|
+
attributes: {
|
|
745
|
+
'aria-hidden': 'true'
|
|
746
|
+
}
|
|
719
747
|
});
|
|
748
|
+
this.controls.durationDisplay.appendChild(durationVisual);
|
|
749
|
+
this.controls.durationVisual = durationVisual;
|
|
720
750
|
|
|
721
751
|
container.appendChild(this.controls.currentTimeDisplay);
|
|
722
752
|
container.appendChild(separator);
|
|
@@ -1790,14 +1820,22 @@ export class ControlBar {
|
|
|
1790
1820
|
this.controls.played.style.width = `${percent}%`;
|
|
1791
1821
|
this.controls.progress.setAttribute('aria-valuenow', String(Math.round(percent)));
|
|
1792
1822
|
|
|
1793
|
-
if (this.controls.
|
|
1794
|
-
|
|
1823
|
+
if (this.controls.currentTimeVisual) {
|
|
1824
|
+
const currentTime = this.player.state.currentTime;
|
|
1825
|
+
// Update visual text (hidden from screen readers)
|
|
1826
|
+
this.controls.currentTimeVisual.textContent = TimeUtils.formatTime(currentTime);
|
|
1827
|
+
// Update aria-label with human-readable format
|
|
1828
|
+
this.controls.currentTimeDisplay.setAttribute('aria-label', TimeUtils.formatDuration(currentTime));
|
|
1795
1829
|
}
|
|
1796
1830
|
}
|
|
1797
1831
|
|
|
1798
1832
|
updateDuration() {
|
|
1799
|
-
if (this.controls.
|
|
1800
|
-
|
|
1833
|
+
if (this.controls.durationVisual) {
|
|
1834
|
+
const duration = this.player.state.duration;
|
|
1835
|
+
// Update visual text (hidden from screen readers)
|
|
1836
|
+
this.controls.durationVisual.textContent = TimeUtils.formatTime(duration);
|
|
1837
|
+
// Update aria-label with human-readable format
|
|
1838
|
+
this.controls.durationDisplay.setAttribute('aria-label', i18n.t('time.durationPrefix') + TimeUtils.formatDuration(duration));
|
|
1801
1839
|
}
|
|
1802
1840
|
}
|
|
1803
1841
|
|
package/src/core/Player.js
CHANGED
|
@@ -515,6 +515,23 @@ export class Player extends EventEmitter {
|
|
|
515
515
|
this.captionManager.destroy();
|
|
516
516
|
this.captionManager = new CaptionManager(this);
|
|
517
517
|
}
|
|
518
|
+
|
|
519
|
+
// Reinitialize transcript manager to pick up new tracks
|
|
520
|
+
if (this.transcriptManager) {
|
|
521
|
+
const wasVisible = this.transcriptManager.isVisible;
|
|
522
|
+
this.transcriptManager.destroy();
|
|
523
|
+
this.transcriptManager = new TranscriptManager(this);
|
|
524
|
+
|
|
525
|
+
// Restore visibility state if transcript was open
|
|
526
|
+
if (wasVisible) {
|
|
527
|
+
this.transcriptManager.showTranscript();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Update control bar to show/hide feature buttons based on new tracks
|
|
532
|
+
if (this.controlBar) {
|
|
533
|
+
this.updateControlBar();
|
|
534
|
+
}
|
|
518
535
|
|
|
519
536
|
this.emit('sourcechange', config);
|
|
520
537
|
this.log('Media loaded successfully');
|
|
@@ -529,6 +546,25 @@ export class Player extends EventEmitter {
|
|
|
529
546
|
* @param {string} src - New source URL
|
|
530
547
|
* @returns {boolean}
|
|
531
548
|
*/
|
|
549
|
+
/**
|
|
550
|
+
* Update control bar to refresh button visibility based on available features
|
|
551
|
+
*/
|
|
552
|
+
updateControlBar() {
|
|
553
|
+
if (!this.controlBar) return;
|
|
554
|
+
|
|
555
|
+
const controlBar = this.controlBar;
|
|
556
|
+
|
|
557
|
+
// Clear existing controls content
|
|
558
|
+
controlBar.element.innerHTML = '';
|
|
559
|
+
|
|
560
|
+
// Recreate controls with updated feature detection
|
|
561
|
+
controlBar.createControls();
|
|
562
|
+
|
|
563
|
+
// Reattach events for the new controls
|
|
564
|
+
controlBar.attachEvents();
|
|
565
|
+
controlBar.setupAutoHide();
|
|
566
|
+
}
|
|
567
|
+
|
|
532
568
|
shouldChangeRenderer(src) {
|
|
533
569
|
if (!this.renderer) return true;
|
|
534
570
|
|