vidply 1.0.34 → 1.0.35

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 (42) hide show
  1. package/dist/dev/{vidply.SoundCloudRenderer-RIA3QKP3.js → vidply.SoundCloudRenderer-HCMKXHSX.js} +1 -3
  2. package/dist/dev/vidply.SoundCloudRenderer-HCMKXHSX.js.map +7 -0
  3. package/dist/dev/{vidply.TranscriptManager-T3BVTZHZ.js → vidply.TranscriptManager-EIIN5YOF.js} +2 -2
  4. package/dist/dev/{vidply.VimeoRenderer-DY2FG7LZ.js → vidply.VimeoRenderer-SLEBCZTT.js} +1 -2
  5. package/dist/dev/vidply.VimeoRenderer-SLEBCZTT.js.map +7 -0
  6. package/dist/dev/{vidply.YouTubeRenderer-EVXXE34A.js → vidply.YouTubeRenderer-E6F4UGVF.js} +1 -2
  7. package/dist/dev/vidply.YouTubeRenderer-E6F4UGVF.js.map +7 -0
  8. package/dist/dev/{vidply.chunk-74NJTDQI.js → vidply.chunk-AXXU22HR.js} +87 -10
  9. package/dist/dev/{vidply.chunk-74NJTDQI.js.map → vidply.chunk-AXXU22HR.js.map} +2 -2
  10. package/dist/dev/vidply.esm.js +32 -50
  11. package/dist/dev/vidply.esm.js.map +2 -2
  12. package/dist/legacy/vidply.js +119 -58
  13. package/dist/legacy/vidply.js.map +3 -3
  14. package/dist/legacy/vidply.min.js +1 -1
  15. package/dist/legacy/vidply.min.meta.json +18 -18
  16. package/dist/prod/vidply.SoundCloudRenderer-D2FNOEG6.min.js +6 -0
  17. package/dist/prod/{vidply.TranscriptManager-GPAOXEK4.min.js → vidply.TranscriptManager-VXCTCJ7X.min.js} +1 -1
  18. package/dist/prod/vidply.VimeoRenderer-QELFZVDU.min.js +6 -0
  19. package/dist/prod/vidply.YouTubeRenderer-ZL6YUHTF.min.js +6 -0
  20. package/dist/prod/{vidply.chunk-OM7DNW5P.min.js → vidply.chunk-Z6BHMOGK.min.js} +1 -1
  21. package/dist/prod/vidply.esm.min.js +3 -3
  22. package/dist/vidply.css +218 -108
  23. package/dist/vidply.esm.min.meta.json +33 -33
  24. package/dist/vidply.min.css +1 -1
  25. package/package.json +3 -3
  26. package/src/controls/ControlBar.js +3 -0
  27. package/src/controls/KeyboardManager.js +19 -0
  28. package/src/core/Player.js +1 -64
  29. package/src/core/SignLanguageManager.js +18 -4
  30. package/src/index.js +3 -1
  31. package/src/renderers/SoundCloudRenderer.js +0 -2
  32. package/src/renderers/VimeoRenderer.js +0 -1
  33. package/src/renderers/YouTubeRenderer.js +0 -1
  34. package/src/styles/vidply.css +218 -108
  35. package/src/utils/DraggableResizable.js +123 -12
  36. package/dist/dev/vidply.SoundCloudRenderer-RIA3QKP3.js.map +0 -7
  37. package/dist/dev/vidply.VimeoRenderer-DY2FG7LZ.js.map +0 -7
  38. package/dist/dev/vidply.YouTubeRenderer-EVXXE34A.js.map +0 -7
  39. package/dist/prod/vidply.SoundCloudRenderer-BFV5SSIU.min.js +0 -6
  40. package/dist/prod/vidply.VimeoRenderer-UQWHQ4LC.min.js +0 -6
  41. package/dist/prod/vidply.YouTubeRenderer-K7A57ICA.min.js +0 -6
  42. /package/dist/dev/{vidply.TranscriptManager-T3BVTZHZ.js.map → vidply.TranscriptManager-EIIN5YOF.js.map} +0 -0
@@ -2065,9 +2065,16 @@
2065
2065
  touchstart: this.onTouchStart.bind(this),
2066
2066
  touchmove: this.onTouchMove.bind(this),
2067
2067
  touchend: this.onTouchEnd.bind(this),
2068
+ pointerdown: this.onPointerDown.bind(this),
2069
+ pointermove: this.onPointerMove.bind(this),
2070
+ pointerup: this.onPointerUp.bind(this),
2071
+ pointercancel: this.onPointerUp.bind(this),
2068
2072
  keydown: this.onKeyDown.bind(this),
2069
- resizeHandleMousedown: this.onResizeHandleMouseDown.bind(this)
2073
+ resizeHandleMousedown: this.onResizeHandleMouseDown.bind(this),
2074
+ resizeHandlePointerDown: this.onResizeHandlePointerDown.bind(this)
2070
2075
  };
2076
+ this.activePointerId = null;
2077
+ this.activePointerType = null;
2071
2078
  this.init();
2072
2079
  }
2073
2080
  hasManagedResizeHandles() {
@@ -2104,17 +2111,28 @@
2104
2111
  }
2105
2112
  init() {
2106
2113
  const dragHandle = this.options.dragHandle || this.element;
2107
- dragHandle.addEventListener("mousedown", this.handlers.mousedown);
2108
- dragHandle.addEventListener("touchstart", this.handlers.touchstart);
2109
- document.addEventListener("mousemove", this.handlers.mousemove);
2110
- document.addEventListener("mouseup", this.handlers.mouseup);
2111
- document.addEventListener("touchmove", this.handlers.touchmove, { passive: false });
2112
- document.addEventListener("touchend", this.handlers.touchend);
2114
+ if (typeof window !== "undefined" && "PointerEvent" in window) {
2115
+ dragHandle.addEventListener("pointerdown", this.handlers.pointerdown);
2116
+ document.addEventListener("pointermove", this.handlers.pointermove, { passive: false });
2117
+ document.addEventListener("pointerup", this.handlers.pointerup);
2118
+ document.addEventListener("pointercancel", this.handlers.pointercancel);
2119
+ } else {
2120
+ dragHandle.addEventListener("mousedown", this.handlers.mousedown);
2121
+ dragHandle.addEventListener("touchstart", this.handlers.touchstart, { passive: false });
2122
+ document.addEventListener("mousemove", this.handlers.mousemove);
2123
+ document.addEventListener("mouseup", this.handlers.mouseup);
2124
+ document.addEventListener("touchmove", this.handlers.touchmove, { passive: false });
2125
+ document.addEventListener("touchend", this.handlers.touchend);
2126
+ }
2113
2127
  this.element.addEventListener("keydown", this.handlers.keydown);
2114
2128
  if (this.options.resizeHandles && this.options.resizeHandles.length > 0) {
2115
2129
  this.options.resizeHandles.forEach((handle) => {
2116
- handle.addEventListener("mousedown", this.handlers.resizeHandleMousedown);
2117
- handle.addEventListener("touchstart", this.handlers.resizeHandleMousedown);
2130
+ if (typeof window !== "undefined" && "PointerEvent" in window) {
2131
+ handle.addEventListener("pointerdown", this.handlers.resizeHandlePointerDown);
2132
+ } else {
2133
+ handle.addEventListener("mousedown", this.handlers.resizeHandleMousedown);
2134
+ handle.addEventListener("touchstart", this.handlers.resizeHandleMousedown, { passive: false });
2135
+ }
2118
2136
  const managed = handle.dataset.vidplyManagedResize === "true";
2119
2137
  this.resizeHandlesManaged.set(handle, managed);
2120
2138
  if (managed) {
@@ -2124,6 +2142,45 @@
2124
2142
  });
2125
2143
  }
2126
2144
  }
2145
+ onPointerDown(e) {
2146
+ var _a, _b;
2147
+ if (e.isPrimary === false) return;
2148
+ if (e.pointerType === "mouse" && e.button !== 0) return;
2149
+ if (e.target.classList.contains("".concat(this.options.classPrefix, "-resize-handle"))) {
2150
+ return;
2151
+ }
2152
+ if (this.options.onDragStart && !this.options.onDragStart(e)) {
2153
+ return;
2154
+ }
2155
+ this.activePointerId = e.pointerId;
2156
+ this.activePointerType = e.pointerType;
2157
+ try {
2158
+ (_b = (_a = e.currentTarget) == null ? void 0 : _a.setPointerCapture) == null ? void 0 : _b.call(_a, e.pointerId);
2159
+ } catch (e2) {
2160
+ }
2161
+ this.startDragging(e.clientX, e.clientY);
2162
+ e.preventDefault();
2163
+ }
2164
+ onPointerMove(e) {
2165
+ if (this.activePointerId !== null && e.pointerId !== this.activePointerId) return;
2166
+ if (this.isDragging) {
2167
+ this.drag(e.clientX, e.clientY);
2168
+ e.preventDefault();
2169
+ } else if (this.isResizing) {
2170
+ this.resize(e.clientX, e.clientY);
2171
+ e.preventDefault();
2172
+ }
2173
+ }
2174
+ onPointerUp(e) {
2175
+ if (this.activePointerId !== null && e.pointerId !== this.activePointerId) return;
2176
+ if (this.isDragging) {
2177
+ this.stopDragging();
2178
+ } else if (this.isResizing) {
2179
+ this.stopResizing();
2180
+ }
2181
+ this.activePointerId = null;
2182
+ this.activePointerType = null;
2183
+ }
2127
2184
  onMouseDown(e) {
2128
2185
  if (e.target.classList.contains("".concat(this.options.classPrefix, "-resize-handle"))) {
2129
2186
  return;
@@ -2143,6 +2200,23 @@
2143
2200
  }
2144
2201
  const touch = e.touches[0];
2145
2202
  this.startDragging(touch.clientX, touch.clientY);
2203
+ e.preventDefault();
2204
+ }
2205
+ onResizeHandlePointerDown(e) {
2206
+ var _a, _b;
2207
+ if (e.isPrimary === false) return;
2208
+ if (e.pointerType === "mouse" && e.button !== 0) return;
2209
+ e.preventDefault();
2210
+ e.stopPropagation();
2211
+ const handle = e.target;
2212
+ this.resizeDirection = handle.getAttribute("data-direction");
2213
+ this.activePointerId = e.pointerId;
2214
+ this.activePointerType = e.pointerType;
2215
+ try {
2216
+ (_b = (_a = e.currentTarget) == null ? void 0 : _a.setPointerCapture) == null ? void 0 : _b.call(_a, e.pointerId);
2217
+ } catch (e2) {
2218
+ }
2219
+ this.startResizing(e.clientX, e.clientY);
2146
2220
  }
2147
2221
  onResizeHandleMouseDown(e) {
2148
2222
  var _a, _b, _c, _d;
@@ -2583,15 +2657,20 @@
2583
2657
  this.disablePointerResizeMode();
2584
2658
  dragHandle.removeEventListener("mousedown", this.handlers.mousedown);
2585
2659
  dragHandle.removeEventListener("touchstart", this.handlers.touchstart);
2660
+ dragHandle.removeEventListener("pointerdown", this.handlers.pointerdown);
2586
2661
  document.removeEventListener("mousemove", this.handlers.mousemove);
2587
2662
  document.removeEventListener("mouseup", this.handlers.mouseup);
2588
2663
  document.removeEventListener("touchmove", this.handlers.touchmove);
2589
2664
  document.removeEventListener("touchend", this.handlers.touchend);
2665
+ document.removeEventListener("pointermove", this.handlers.pointermove);
2666
+ document.removeEventListener("pointerup", this.handlers.pointerup);
2667
+ document.removeEventListener("pointercancel", this.handlers.pointercancel);
2590
2668
  this.element.removeEventListener("keydown", this.handlers.keydown);
2591
2669
  if (this.options.resizeHandles && this.options.resizeHandles.length > 0) {
2592
2670
  this.options.resizeHandles.forEach((handle) => {
2593
2671
  handle.removeEventListener("mousedown", this.handlers.resizeHandleMousedown);
2594
2672
  handle.removeEventListener("touchstart", this.handlers.resizeHandleMousedown);
2673
+ handle.removeEventListener("pointerdown", this.handlers.resizeHandlePointerDown);
2595
2674
  });
2596
2675
  }
2597
2676
  this.element.classList.remove(
@@ -4596,7 +4675,6 @@
4596
4675
  this.iframe = document.createElement("div");
4597
4676
  this.iframe.id = "youtube-player-".concat(Math.random().toString(36).substr(2, 9));
4598
4677
  this.iframe.style.width = "100%";
4599
- this.iframe.style.aspectRatio = "16 / 9";
4600
4678
  this.iframe.style.maxHeight = "100%";
4601
4679
  this.player.element.parentNode.insertBefore(this.iframe, this.player.element);
4602
4680
  }
@@ -4821,7 +4899,6 @@
4821
4899
  this.iframe = document.createElement("div");
4822
4900
  this.iframe.id = "vimeo-player-".concat(Math.random().toString(36).substr(2, 9));
4823
4901
  this.iframe.style.width = "100%";
4824
- this.iframe.style.aspectRatio = "16 / 9";
4825
4902
  this.iframe.style.maxHeight = "100%";
4826
4903
  this.player.element.parentNode.insertBefore(this.iframe, this.player.element);
4827
4904
  }
@@ -5409,10 +5486,8 @@
5409
5486
  this.iframe.style.width = "100%";
5410
5487
  this.iframe.style.display = "block";
5411
5488
  if (this.isPlaylist()) {
5412
- this.iframe.style.aspectRatio = "16 / 9";
5413
5489
  this.iframe.classList.add("vidply-soundcloud-iframe", "vidply-soundcloud-playlist");
5414
5490
  } else {
5415
- this.iframe.style.aspectRatio = "16 / 3";
5416
5491
  this.iframe.classList.add("vidply-soundcloud-iframe");
5417
5492
  }
5418
5493
  this.iframe.style.maxHeight = "100%";
@@ -5846,6 +5921,7 @@
5846
5921
  }
5847
5922
  if (menuRect.top < 10) {
5848
5923
  menu.style.top = "10px";
5924
+ menu.style.bottom = "auto";
5849
5925
  }
5850
5926
  if (menuRect.bottom > viewportHeight - 10) {
5851
5927
  menu.style.bottom = "10px";
@@ -8808,6 +8884,7 @@
8808
8884
  }
8809
8885
  }
8810
8886
  handleKeydown(e) {
8887
+ var _a, _b;
8811
8888
  if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA" || e.target.tagName === "SELECT") {
8812
8889
  return;
8813
8890
  }
@@ -8821,6 +8898,20 @@
8821
8898
  if (playlistButton) {
8822
8899
  return;
8823
8900
  }
8901
+ const signWrapper = activeElement.closest(".vidply-sign-language-wrapper");
8902
+ if (signWrapper) {
8903
+ const draggable = (_a = this.player.signLanguageManager) == null ? void 0 : _a.draggable;
8904
+ if ((draggable == null ? void 0 : draggable.keyboardDragMode) || (draggable == null ? void 0 : draggable.keyboardResizeMode)) {
8905
+ return;
8906
+ }
8907
+ }
8908
+ const transcriptWindow = activeElement.closest(".vidply-transcript-window");
8909
+ if (transcriptWindow) {
8910
+ const draggable = (_b = this.player.transcriptManager) == null ? void 0 : _b.draggableResizable;
8911
+ if ((draggable == null ? void 0 : draggable.keyboardDragMode) || (draggable == null ? void 0 : draggable.keyboardResizeMode)) {
8912
+ return;
8913
+ }
8914
+ }
8824
8915
  }
8825
8916
  const key = e.key;
8826
8917
  let handled = false;
@@ -9894,9 +9985,10 @@
9894
9985
  * Setup interaction (drag and resize)
9895
9986
  */
9896
9987
  _setupInteraction() {
9988
+ var _a, _b;
9897
9989
  const isMobile2 = window.innerWidth < 768;
9898
9990
  const isFullscreen = this.player.state.fullscreen;
9899
- if (isMobile2 && !isFullscreen) {
9991
+ if (isMobile2 && !isFullscreen && ((_b = (_a = this.player) == null ? void 0 : _a.options) == null ? void 0 : _b.signLanguageDragOnMobile) === false) {
9900
9992
  if (this.draggable) {
9901
9993
  this.draggable.destroy();
9902
9994
  this.draggable = null;
@@ -9906,7 +9998,9 @@
9906
9998
  if (this.draggable) return;
9907
9999
  const classPrefix = this.player.options.classPrefix;
9908
10000
  this.draggable = new DraggableResizable(this.wrapper, {
9909
- dragHandle: this.header,
10001
+ // Allow dragging from anywhere on the sign-language window (better for touch).
10002
+ // We still block dragging when interacting with controls via `onDragStart` below.
10003
+ dragHandle: this.wrapper,
9910
10004
  resizeHandles: this.resizeHandles,
9911
10005
  constrainToViewport: true,
9912
10006
  maintainAspectRatio: true,
@@ -10159,10 +10253,18 @@
10159
10253
  label: "player.enableSignDragMode",
10160
10254
  hasTextClass: true,
10161
10255
  onClick: () => {
10256
+ var _a2;
10162
10257
  this.toggleKeyboardDragMode();
10163
- this.hideSettingsMenu();
10258
+ this.hideSettingsMenu({ focusButton: false });
10259
+ if ((_a2 = this.draggable) == null ? void 0 : _a2.keyboardDragMode) {
10260
+ setTimeout(() => {
10261
+ var _a3, _b2;
10262
+ (_b2 = (_a3 = this.wrapper) == null ? void 0 : _a3.focus) == null ? void 0 : _b2.call(_a3, { preventScroll: true });
10263
+ }, 20);
10264
+ }
10164
10265
  }
10165
10266
  });
10267
+ dragOption.setAttribute("data-setting", "keyboard-drag");
10166
10268
  dragOption.setAttribute("role", "switch");
10167
10269
  dragOption.setAttribute("aria-checked", "false");
10168
10270
  this._removeTooltipFromMenuItem(dragOption);
@@ -10942,23 +11044,9 @@
10942
11044
  if (this.options.height) {
10943
11045
  this.container.style.height = typeof this.options.height === "number" ? "".concat(this.options.height, "px") : this.options.height;
10944
11046
  }
10945
- if (this.element.tagName === "VIDEO" && !this.options.height) {
10946
- const wAttr = parseInt(this.element.getAttribute("width") || "", 10);
10947
- const hAttr = parseInt(this.element.getAttribute("height") || "", 10);
10948
- if (Number.isFinite(wAttr) && Number.isFinite(hAttr) && wAttr > 0 && hAttr > 0) {
10949
- if (!this.container.style.aspectRatio) {
10950
- this.container.style.aspectRatio = "".concat(wAttr, " / ").concat(hAttr);
10951
- }
10952
- if (this.videoWrapper && !this.videoWrapper.style.aspectRatio) {
10953
- this.videoWrapper.style.aspectRatio = "".concat(wAttr, " / ").concat(hAttr);
10954
- this.videoWrapper.style.height = "auto";
10955
- }
10956
- }
10957
- }
10958
11047
  if (this.options.poster && this.element.tagName === "VIDEO") {
10959
11048
  const resolvedPoster = this.resolvePosterPath(this.options.poster);
10960
11049
  this.element.poster = resolvedPoster;
10961
- this.applyPosterAspectRatio(resolvedPoster);
10962
11050
  }
10963
11051
  if (this.element.tagName === "VIDEO") {
10964
11052
  this.createPlayButtonOverlay();
@@ -10986,34 +11074,6 @@
10986
11074
  }
10987
11075
  }, { once: true });
10988
11076
  }
10989
- /**
10990
- * Apply aspect ratio to the video wrapper based on the poster's intrinsic size.
10991
- * This helps render correct poster sizing before media metadata is available.
10992
- */
10993
- applyPosterAspectRatio(posterUrl) {
10994
- try {
10995
- if (!posterUrl) return;
10996
- if (this.element.tagName !== "VIDEO") return;
10997
- if (!this.videoWrapper) return;
10998
- if (this.options.width || this.options.height) return;
10999
- if (this._posterAspectAppliedFor === posterUrl) return;
11000
- this._posterAspectAppliedFor = posterUrl;
11001
- const img = new Image();
11002
- img.decoding = "async";
11003
- img.onload = () => {
11004
- const w = img.naturalWidth;
11005
- const h = img.naturalHeight;
11006
- if (!w || !h) return;
11007
- this.videoWrapper.style.aspectRatio = "".concat(w, " / ").concat(h);
11008
- this.videoWrapper.style.height = "auto";
11009
- if (this.container && !this.container.style.aspectRatio) {
11010
- this.container.style.aspectRatio = "".concat(w, " / ").concat(h);
11011
- }
11012
- };
11013
- img.src = posterUrl;
11014
- } catch (e) {
11015
- }
11016
- }
11017
11077
  createPlayButtonOverlay() {
11018
11078
  this.playButtonOverlay = createPlayOverlay();
11019
11079
  this.playButtonOverlay.addEventListener("click", () => {
@@ -15427,6 +15487,7 @@
15427
15487
  "responsive": "responsive",
15428
15488
  "pipButton": "pipButton",
15429
15489
  "fullscreenButton": "fullscreenButton"
15490
+ // Layout
15430
15491
  };
15431
15492
  Object.keys(attributeMap).forEach((dataKey) => {
15432
15493
  const optionKey = attributeMap[dataKey];