vidply 1.0.0 → 1.0.2

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": 12356,
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": 30813,
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",
@@ -288,7 +288,7 @@
288
288
  "bytesInOutput": 728
289
289
  },
290
290
  "src/icons/Icons.js": {
291
- "bytesInOutput": 10596
291
+ "bytesInOutput": 10407
292
292
  },
293
293
  "src/i18n/translations.js": {
294
294
  "bytesInOutput": 12646
@@ -312,7 +312,7 @@
312
312
  "bytesInOutput": 12461
313
313
  },
314
314
  "src/core/Player.js": {
315
- "bytesInOutput": 16392
315
+ "bytesInOutput": 16389
316
316
  },
317
317
  "src/renderers/YouTubeRenderer.js": {
318
318
  "bytesInOutput": 4140
@@ -327,10 +327,10 @@
327
327
  "bytesInOutput": 5245
328
328
  },
329
329
  "src/index.js": {
330
- "bytesInOutput": 243
330
+ "bytesInOutput": 1000
331
331
  }
332
332
  },
333
- "bytes": 128297
333
+ "bytes": 128862
334
334
  }
335
335
  }
336
336
  }
package/dist/vidply.js CHANGED
@@ -522,8 +522,8 @@ var VidPly = (() => {
522
522
  transcript: `<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>`,
523
523
  audioDescription: `<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"/>`,
524
524
  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"/>`,
525
- 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"/>`,
526
- 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"/>`,
525
+ 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>`,
526
+ 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>`,
527
527
  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"/>`,
528
528
  music: `<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-7zm-1.5 16c-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"/>`,
529
529
  moreVertical: `<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>`,
@@ -5024,7 +5024,7 @@ var VidPly = (() => {
5024
5024
  this.signLanguageVideo = document.createElement("video");
5025
5025
  this.signLanguageVideo.className = "vidply-sign-language-video";
5026
5026
  this.signLanguageVideo.src = this.signLanguageSrc;
5027
- this.signLanguageVideo.setAttribute("aria-label", this.i18n.t("signLanguageVideo"));
5027
+ this.signLanguageVideo.setAttribute("aria-label", i18n.t("player.signLanguage"));
5028
5028
  const position = this.options.signLanguagePosition || "bottom-right";
5029
5029
  this.signLanguageVideo.classList.add(`vidply-sign-position-${position}`);
5030
5030
  this.signLanguageVideo.muted = true;
@@ -5032,7 +5032,7 @@ var VidPly = (() => {
5032
5032
  if (!this.state.paused) {
5033
5033
  this.signLanguageVideo.play();
5034
5034
  }
5035
- this.container.appendChild(this.signLanguageVideo);
5035
+ this.videoWrapper.appendChild(this.signLanguageVideo);
5036
5036
  this.signLanguageHandlers = {
5037
5037
  play: () => {
5038
5038
  if (this.signLanguageVideo) {
@@ -5561,9 +5561,56 @@ var VidPly = (() => {
5561
5561
  const elements = document.querySelectorAll("[data-vidply]");
5562
5562
  elements.forEach((element) => {
5563
5563
  const options = element.dataset.vidplyOptions ? JSON.parse(element.dataset.vidplyOptions) : {};
5564
- new Player(element, options);
5564
+ const dataOptions = parseDataAttributes(element.dataset);
5565
+ const mergedOptions = { ...dataOptions, ...options };
5566
+ new Player(element, mergedOptions);
5565
5567
  });
5566
5568
  }
5569
+ function parseDataAttributes(dataset) {
5570
+ const options = {};
5571
+ const attributeMap = {
5572
+ // Sign Language
5573
+ "signLanguageSrc": "signLanguageSrc",
5574
+ "signLanguageButton": "signLanguageButton",
5575
+ "signLanguagePosition": "signLanguagePosition",
5576
+ // Audio Description
5577
+ "audioDescriptionSrc": "audioDescriptionSrc",
5578
+ "audioDescriptionButton": "audioDescriptionButton",
5579
+ // Other common options
5580
+ "autoplay": "autoplay",
5581
+ "loop": "loop",
5582
+ "muted": "muted",
5583
+ "controls": "controls",
5584
+ "poster": "poster",
5585
+ "width": "width",
5586
+ "height": "height",
5587
+ "language": "language",
5588
+ "captions": "captions",
5589
+ "captionsDefault": "captionsDefault",
5590
+ "transcript": "transcript",
5591
+ "transcriptButton": "transcriptButton",
5592
+ "keyboard": "keyboard",
5593
+ "responsive": "responsive",
5594
+ "pipButton": "pipButton",
5595
+ "fullscreenButton": "fullscreenButton"
5596
+ };
5597
+ Object.keys(attributeMap).forEach((dataKey) => {
5598
+ const optionKey = attributeMap[dataKey];
5599
+ const value = dataset[dataKey];
5600
+ if (value !== void 0) {
5601
+ if (value === "true") {
5602
+ options[optionKey] = true;
5603
+ } else if (value === "false") {
5604
+ options[optionKey] = false;
5605
+ } else if (!isNaN(value) && value !== "") {
5606
+ options[optionKey] = Number(value);
5607
+ } else {
5608
+ options[optionKey] = value;
5609
+ }
5610
+ }
5611
+ });
5612
+ return options;
5613
+ }
5567
5614
  if (document.readyState === "loading") {
5568
5615
  document.addEventListener("DOMContentLoaded", initializePlayers);
5569
5616
  } else {