vidply 1.0.0 → 1.0.1

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.
@@ -16,7 +16,7 @@
16
16
  "format": "esm"
17
17
  },
18
18
  "src/icons/Icons.js": {
19
- "bytes": 12581,
19
+ "bytes": 12559,
20
20
  "imports": [],
21
21
  "format": "esm"
22
22
  },
@@ -157,7 +157,7 @@
157
157
  "format": "esm"
158
158
  },
159
159
  "src/core/Player.js": {
160
- "bytes": 30756,
160
+ "bytes": 30753,
161
161
  "imports": [
162
162
  {
163
163
  "path": "src/utils/EventEmitter.js",
@@ -249,7 +249,7 @@
249
249
  "format": "esm"
250
250
  },
251
251
  "src/index.js": {
252
- "bytes": 833,
252
+ "bytes": 2706,
253
253
  "imports": [
254
254
  {
255
255
  "path": "src/core/Player.js",
@@ -275,7 +275,7 @@
275
275
  "bytesInOutput": 4670
276
276
  },
277
277
  "src/index.js": {
278
- "bytesInOutput": 307
278
+ "bytesInOutput": 1064
279
279
  },
280
280
  "src/utils/EventEmitter.js": {
281
281
  "bytesInOutput": 436
@@ -287,7 +287,7 @@
287
287
  "bytesInOutput": 728
288
288
  },
289
289
  "src/icons/Icons.js": {
290
- "bytesInOutput": 10596
290
+ "bytesInOutput": 10574
291
291
  },
292
292
  "src/i18n/translations.js": {
293
293
  "bytesInOutput": 12646
@@ -311,7 +311,7 @@
311
311
  "bytesInOutput": 12461
312
312
  },
313
313
  "src/core/Player.js": {
314
- "bytesInOutput": 16392
314
+ "bytesInOutput": 16386
315
315
  },
316
316
  "src/renderers/YouTubeRenderer.js": {
317
317
  "bytesInOutput": 4140
@@ -326,7 +326,7 @@
326
326
  "bytesInOutput": 5245
327
327
  }
328
328
  },
329
- "bytes": 128662
329
+ "bytes": 129391
330
330
  }
331
331
  }
332
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidply",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Universal, accessible video & audio player with ES6 modules",
5
5
  "type": "module",
6
6
  "main": "dist/vidply.js",
@@ -828,7 +828,7 @@ export class Player extends EventEmitter {
828
828
  this.signLanguageVideo = document.createElement('video');
829
829
  this.signLanguageVideo.className = 'vidply-sign-language-video';
830
830
  this.signLanguageVideo.src = this.signLanguageSrc;
831
- this.signLanguageVideo.setAttribute('aria-label', this.i18n.t('signLanguageVideo'));
831
+ this.signLanguageVideo.setAttribute('aria-label', i18n.t('player.signLanguage'));
832
832
 
833
833
  // Set position based on options
834
834
  const position = this.options.signLanguagePosition || 'bottom-right';
@@ -75,9 +75,9 @@ const iconPaths = {
75
75
 
76
76
  audioDescriptionOn: `<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z"/><path d="M10.5 19c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/><circle cx="19" cy="16" r="3" fill="#3b82f6"/><path d="M18.5 17.5l1-1 1.5 1.5" stroke="white" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`,
77
77
 
78
- signLanguage: `<path d="M12 2C10.34 2 9 3.34 9 5v4c0 .34.07.66.18.96L7.5 8.29C7.19 8.1 6.85 8 6.5 8 5.12 8 4 9.12 4 10.5v3c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-3c0-.28.22-.5.5-.5s.5.22.5.5V14l2 2v-1c0-.55.45-1 1-1s1 .45 1 1v2c0 .55.45 1 1 1s1-.45 1-1V9c0-.55.45-1 1-1s1 .45 1 1v8c0 2.21-1.79 4-4 4s-4-1.79-4-4v-2.83l-2.93-2.93A3.93 3.93 0 0 1 4 8c0-1.66 1.34-3 3-3 .83 0 1.58.34 2.12.88L11 7.76V5c0-.55.45-1 1-1s1 .45 1 1v4c0 .55.45 1 1 1s1-.45 1-1V5c0-1.66-1.34-3-3-3z"/>`,
78
+ signLanguage: `<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>`,
79
79
 
80
- signLanguageOn: `<path d="M12 2C10.34 2 9 3.34 9 5v4c0 .34.07.66.18.96L7.5 8.29C7.19 8.1 6.85 8 6.5 8 5.12 8 4 9.12 4 10.5v3c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-3c0-.28.22-.5.5-.5s.5.22.5.5V14l2 2v-1c0-.55.45-1 1-1s1 .45 1 1v2c0 .55.45 1 1 1s1-.45 1-1V9c0-.55.45-1 1-1s1 .45 1 1v8c0 2.21-1.79 4-4 4s-4-1.79-4-4v-2.83l-2.93-2.93A3.93 3.93 0 0 1 4 8c0-1.66 1.34-3 3-3 .83 0 1.58.34 2.12.88L11 7.76V5c0-.55.45-1 1-1s1 .45 1 1v4c0 .55.45 1 1 1s1-.45 1-1V5c0-1.66-1.34-3-3-3z"/><circle cx="19" cy="16" r="3" fill="#3b82f6"/><path d="M18.5 17.5l1-1 1.5 1.5" stroke="white" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`,
80
+ signLanguageOn: `<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g><circle cx="19" cy="19" r="3" fill="#3b82f6"/><path d="M17.5 19l1 1 2-2" stroke="white" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`,
81
81
 
82
82
  speaker: `<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>`,
83
83
 
package/src/index.js CHANGED
@@ -11,14 +11,75 @@ function initializePlayers() {
11
11
  const elements = document.querySelectorAll('[data-vidply]');
12
12
 
13
13
  elements.forEach(element => {
14
- // Parse options from data attribute
14
+ // Parse options from data attribute (JSON format)
15
15
  const options = element.dataset.vidplyOptions
16
16
  ? JSON.parse(element.dataset.vidplyOptions)
17
17
  : {};
18
18
 
19
+ // Parse individual data attributes and merge with options
20
+ // This allows for easier HTML-based configuration
21
+ const dataOptions = parseDataAttributes(element.dataset);
22
+ const mergedOptions = { ...dataOptions, ...options };
23
+
19
24
  // Create player instance
20
- new Player(element, options);
25
+ new Player(element, mergedOptions);
26
+ });
27
+ }
28
+
29
+ // Helper function to parse data attributes into options
30
+ function parseDataAttributes(dataset) {
31
+ const options = {};
32
+
33
+ // Map of data attribute names to option keys (camelCase conversion)
34
+ const attributeMap = {
35
+ // Sign Language
36
+ 'signLanguageSrc': 'signLanguageSrc',
37
+ 'signLanguageButton': 'signLanguageButton',
38
+ 'signLanguagePosition': 'signLanguagePosition',
39
+
40
+ // Audio Description
41
+ 'audioDescriptionSrc': 'audioDescriptionSrc',
42
+ 'audioDescriptionButton': 'audioDescriptionButton',
43
+
44
+ // Other common options
45
+ 'autoplay': 'autoplay',
46
+ 'loop': 'loop',
47
+ 'muted': 'muted',
48
+ 'controls': 'controls',
49
+ 'poster': 'poster',
50
+ 'width': 'width',
51
+ 'height': 'height',
52
+ 'language': 'language',
53
+ 'captions': 'captions',
54
+ 'captionsDefault': 'captionsDefault',
55
+ 'transcript': 'transcript',
56
+ 'transcriptButton': 'transcriptButton',
57
+ 'keyboard': 'keyboard',
58
+ 'responsive': 'responsive',
59
+ 'pipButton': 'pipButton',
60
+ 'fullscreenButton': 'fullscreenButton'
61
+ };
62
+
63
+ // Parse each data attribute
64
+ Object.keys(attributeMap).forEach(dataKey => {
65
+ const optionKey = attributeMap[dataKey];
66
+ const value = dataset[dataKey];
67
+
68
+ if (value !== undefined) {
69
+ // Convert string values to appropriate types
70
+ if (value === 'true') {
71
+ options[optionKey] = true;
72
+ } else if (value === 'false') {
73
+ options[optionKey] = false;
74
+ } else if (!isNaN(value) && value !== '') {
75
+ options[optionKey] = Number(value);
76
+ } else {
77
+ options[optionKey] = value;
78
+ }
79
+ }
21
80
  });
81
+
82
+ return options;
22
83
  }
23
84
 
24
85
  // Auto-initialize on DOM ready
@@ -1662,6 +1662,59 @@
1662
1662
  background: var(--vidply-border-hover);
1663
1663
  }
1664
1664
 
1665
+ /* Sign Language Video */
1666
+ .vidply-sign-language-video {
1667
+ background: var(--vidply-black);
1668
+ border: 2px solid var(--vidply-white-30);
1669
+ border-radius: 4px;
1670
+ box-shadow: 0 4px 12px var(--vidply-black-60);
1671
+ height: auto !important;
1672
+ max-width: 400px;
1673
+ min-width: 150px;
1674
+ position: absolute;
1675
+ transition: opacity 0.3s ease;
1676
+ width: 35% !important;
1677
+ z-index: 100;
1678
+ }
1679
+
1680
+ .vidply-fullscreen .vidply-sign-language-video {
1681
+ max-width: 600px;
1682
+ }
1683
+
1684
+ /* Sign Language Video Positions */
1685
+ .vidply-sign-position-bottom-right {
1686
+ bottom: 80px; /* Above controls */
1687
+ right: 16px;
1688
+ }
1689
+
1690
+ .vidply-sign-position-bottom-left {
1691
+ bottom: 80px; /* Above controls */
1692
+ left: 16px;
1693
+ }
1694
+
1695
+ .vidply-sign-position-top-right {
1696
+ right: 16px;
1697
+ top: 16px;
1698
+ }
1699
+
1700
+ .vidply-sign-position-top-left {
1701
+ left: 16px;
1702
+ top: 16px;
1703
+ }
1704
+
1705
+ /* Responsive Sign Language Video */
1706
+ @media (width <= 640px) {
1707
+ .vidply-sign-language-video {
1708
+ min-width: 120px;
1709
+ width: 30%;
1710
+ }
1711
+
1712
+ .vidply-sign-position-bottom-right,
1713
+ .vidply-sign-position-bottom-left {
1714
+ bottom: 70px; /* Adjust for smaller controls */
1715
+ }
1716
+ }
1717
+
1665
1718
  /* Responsive Adjustments */
1666
1719
  @media (width <= 640px) {
1667
1720
  .vidply-playlist-thumbnail {