cursedbelt 5.96.1 → 5.98.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.
- package/dist/react/components/PaneSplit.d.ts +11 -2
- package/dist/react/components/PaneSplit.d.ts.map +1 -1
- package/dist/react/components/PaneSplit.js +12 -11
- package/dist/react/components/PaneSplit.js.map +1 -1
- package/dist/react/components/PanelGrid.d.ts +14 -8
- package/dist/react/components/PanelGrid.d.ts.map +1 -1
- package/dist/react/components/PanelGrid.js +10 -3
- package/dist/react/components/PanelGrid.js.map +1 -1
- package/dist/react/components/SplitPane.d.ts +3 -9
- package/dist/react/components/SplitPane.d.ts.map +1 -1
- package/dist/react/components/SplitPane.js +0 -3
- package/dist/react/components/SplitPane.js.map +1 -1
- package/dist/react/components/paneSplit.css +8 -0
- package/dist/react/filter-rail/railResize.d.ts +16 -5
- package/dist/react/filter-rail/railResize.d.ts.map +1 -1
- package/dist/react/filter-rail/railResize.js +27 -9
- package/dist/react/filter-rail/railResize.js.map +1 -1
- package/dist/react/filter-rail/railWidth.d.ts +10 -5
- package/dist/react/filter-rail/railWidth.d.ts.map +1 -1
- package/dist/react/filter-rail/railWidth.js +13 -8
- package/dist/react/filter-rail/railWidth.js.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/paneReach.d.ts +36 -0
- package/dist/react/lib/paneReach.d.ts.map +1 -0
- package/dist/react/lib/paneReach.js +72 -0
- package/dist/react/lib/paneReach.js.map +1 -0
- package/dist/react/master-detail/MasterDetail.d.ts +6 -3
- package/dist/react/master-detail/MasterDetail.d.ts.map +1 -1
- package/dist/react/master-detail/MasterDetail.js +3 -2
- package/dist/react/master-detail/MasterDetail.js.map +1 -1
- package/dist/react/media/FocusViewer.d.ts.map +1 -1
- package/dist/react/media/FocusViewer.js +3 -2
- package/dist/react/media/FocusViewer.js.map +1 -1
- package/dist/react/media/ImageOriginalToggle.d.ts +20 -0
- package/dist/react/media/ImageOriginalToggle.d.ts.map +1 -0
- package/dist/react/media/ImageOriginalToggle.js +16 -0
- package/dist/react/media/ImageOriginalToggle.js.map +1 -0
- package/dist/react/media/VideoPlayer.d.ts.map +1 -1
- package/dist/react/media/VideoPlayer.js +9 -3
- package/dist/react/media/VideoPlayer.js.map +1 -1
- package/dist/react/media/VideoQualitySelect.d.ts +24 -0
- package/dist/react/media/VideoQualitySelect.d.ts.map +1 -0
- package/dist/react/media/VideoQualitySelect.js +34 -0
- package/dist/react/media/VideoQualitySelect.js.map +1 -0
- package/dist/react/media/hlsSource.d.ts +14 -2
- package/dist/react/media/hlsSource.d.ts.map +1 -1
- package/dist/react/media/hlsSource.js +27 -6
- package/dist/react/media/hlsSource.js.map +1 -1
- package/dist/react/media/imageOriginal.d.ts +69 -0
- package/dist/react/media/imageOriginal.d.ts.map +1 -0
- package/dist/react/media/imageOriginal.js +98 -0
- package/dist/react/media/imageOriginal.js.map +1 -0
- package/dist/react/media/imageOriginalEntry.d.ts +9 -0
- package/dist/react/media/imageOriginalEntry.d.ts.map +1 -0
- package/dist/react/media/imageOriginalEntry.js +9 -0
- package/dist/react/media/imageOriginalEntry.js.map +1 -0
- package/dist/react/media/index.d.ts +5 -0
- package/dist/react/media/index.d.ts.map +1 -1
- package/dist/react/media/index.js +6 -0
- package/dist/react/media/index.js.map +1 -1
- package/dist/react/media/useImageOriginal.d.ts +21 -0
- package/dist/react/media/useImageOriginal.d.ts.map +1 -0
- package/dist/react/media/useImageOriginal.js +63 -0
- package/dist/react/media/useImageOriginal.js.map +1 -0
- package/dist/react/media/videoEnhance.d.ts +1 -1
- package/dist/react/media/videoEnhance.js +1 -1
- package/dist/react/media/videoPlayer.css +23 -0
- package/dist/react/media/videoQuality.d.ts +113 -0
- package/dist/react/media/videoQuality.d.ts.map +1 -0
- package/dist/react/media/videoQuality.js +185 -0
- package/dist/react/media/videoQuality.js.map +1 -0
- package/dist/react/media/vidstackQuality.d.ts +27 -0
- package/dist/react/media/vidstackQuality.d.ts.map +1 -0
- package/dist/react/media/vidstackQuality.js +51 -0
- package/dist/react/media/vidstackQuality.js.map +1 -0
- package/dist/react/media-gallery/MediaGallery.d.ts.map +1 -1
- package/dist/react/media-gallery/MediaGallery.js +42 -10
- package/dist/react/media-gallery/MediaGallery.js.map +1 -1
- package/dist/react/media-gallery/mediaGallery.css +42 -0
- package/dist/react/media-gallery/mediaGalleryModel.d.ts.map +1 -1
- package/dist/react/media-gallery/mediaGalleryModel.js +5 -2
- package/dist/react/media-gallery/mediaGalleryModel.js.map +1 -1
- package/dist/react/media-gallery/types.d.ts +10 -0
- package/dist/react/media-gallery/types.d.ts.map +1 -1
- package/dist/react/sharing/SharePanel.d.ts.map +1 -1
- package/dist/react/sharing/SharePanel.js +2 -1
- package/dist/react/sharing/SharePanel.js.map +1 -1
- package/dist/scripts/guardrailsEnforce.d.ts.map +1 -1
- package/dist/testing/phoneRules.js +3 -3
- package/dist/testing/phoneRules.js.map +1 -1
- package/package.json +9 -2
- package/scripts/guardrailsEnforce.spec.ts +25 -0
- package/scripts/guardrailsEnforce.ts +61 -0
- package/scripts/paths.ts +1 -1
- package/scripts/styleAreas.ts +2 -1
- package/src/react/components/PaneSplit.spec.tsx +26 -3
- package/src/react/components/PaneSplit.tsx +26 -13
- package/src/react/components/PanelGrid.tsx +16 -11
- package/src/react/components/SplitPane.spec.tsx +10 -5
- package/src/react/components/SplitPane.tsx +3 -12
- package/src/react/components/paneSplit.css +8 -0
- package/src/react/filter-rail/FilterRail.spec.tsx +7 -3
- package/src/react/filter-rail/railResize.spec.tsx +27 -5
- package/src/react/filter-rail/railResize.tsx +46 -15
- package/src/react/filter-rail/railWidth.ts +13 -8
- package/src/react/index.ts +1 -0
- package/src/react/lib/paneReach.spec.ts +58 -0
- package/src/react/lib/paneReach.ts +65 -0
- package/src/react/master-detail/MasterDetail.tsx +10 -5
- package/src/react/media/FocusViewer.tsx +9 -1
- package/src/react/media/ImageOriginalToggle.tsx +49 -0
- package/src/react/media/VideoPlayer.spec.tsx +44 -1
- package/src/react/media/VideoPlayer.tsx +17 -3
- package/src/react/media/VideoQualitySelect.spec.tsx +47 -0
- package/src/react/media/VideoQualitySelect.tsx +81 -0
- package/src/react/media/hlsSource.spec.ts +10 -0
- package/src/react/media/hlsSource.ts +41 -7
- package/src/react/media/imageOriginal.spec.tsx +177 -0
- package/src/react/media/imageOriginal.ts +114 -0
- package/src/react/media/imageOriginalEntry.ts +8 -0
- package/src/react/media/index.ts +9 -0
- package/src/react/media/useImageOriginal.ts +97 -0
- package/src/react/media/videoEnhance.ts +1 -1
- package/src/react/media/videoPlayer.css +23 -0
- package/src/react/media/videoQuality.spec.ts +135 -0
- package/src/react/media/videoQuality.ts +248 -0
- package/src/react/media/vidstackQuality.tsx +65 -0
- package/src/react/media-gallery/MediaGallery.spec.tsx +26 -0
- package/src/react/media-gallery/MediaGallery.tsx +57 -17
- package/src/react/media-gallery/mediaGallery.css +42 -0
- package/src/react/media-gallery/mediaGalleryModel.ts +4 -2
- package/src/react/media-gallery/types.ts +10 -0
- package/src/react/sharing/SharePanel.tsx +2 -1
- package/src/testing/phoneRules.ts +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageOriginalEntry.d.ts","sourceRoot":"","sources":["../../../src/react/media/imageOriginalEntry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cursedbelt/react/media/image-original` — a picture's original past its web copy (forge task
|
|
3
|
+
* 3873), for an app that draws its own `<img>` and must not bundle the media barrel's optional
|
|
4
|
+
* peers (photos' zoomable asset page). The gallery stage uses the same three modules.
|
|
5
|
+
*/
|
|
6
|
+
export { originalUndrawableReason } from './imageOriginal.js';
|
|
7
|
+
export { ImageOriginalToggle } from './ImageOriginalToggle.js';
|
|
8
|
+
export { useImageOriginal } from './useImageOriginal.js';
|
|
9
|
+
//# sourceMappingURL=imageOriginalEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageOriginalEntry.js","sourceRoot":"","sources":["../../../src/react/media/imageOriginalEntry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA6B,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAiC,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAoD,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -25,6 +25,11 @@ export { useIntersectionObserver } from './useIntersectionObserver.js';
|
|
|
25
25
|
export { useObjectUrl } from './useObjectUrl.js';
|
|
26
26
|
export { attachHlsSource, canPlayHlsNatively, type HlsSourceUrls, useHlsSource } from './hlsSource.js';
|
|
27
27
|
export { PLAYBACK_RATES, preferBundledHls, VideoPlayer, type VideoPlayerProps } from './VideoPlayer.js';
|
|
28
|
+
export type { VideoQualityControl } from './videoQuality.js';
|
|
29
|
+
export { VideoQualitySelect, type VideoQualitySelectProps } from './VideoQualitySelect.js';
|
|
30
|
+
export { type ImageOriginalControl, originalUndrawableReason } from './imageOriginal.js';
|
|
31
|
+
export { ImageOriginalToggle, type ImageOriginalToggleProps } from './ImageOriginalToggle.js';
|
|
32
|
+
export { type ImageOriginal, type UseImageOriginalOptions, useImageOriginal } from './useImageOriginal.js';
|
|
28
33
|
export { FocusViewer, type FocusSaveResult, type FocusSnapshot, type FocusViewerProps, } from './FocusViewer.js';
|
|
29
34
|
export { PictureControls, type PictureControlsProps } from './PictureControls.js';
|
|
30
35
|
export { composeSelection, FULL_REGION, fitBox, isFullRegion, MAX_ZOOM, normalizeRect, panRegion, type Region, regionAtZoom, regionLayout, regionPixels, regionZoom, stageAspectFor, zoomRegion, } from './videoRegion.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/media/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,KAAK,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,KAAK,0BAA0B,EAC/B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AACnC,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AKjD,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK/E,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,KAAK,QAAQ,GACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,aAAa,EACb,oBAAoB,EACpB,KAAK,aAAa,EAClB,UAAU,EACV,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,cAAc,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/media/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAA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mB,EAAE,MAAM,qBAAqB,CAAC;AAK/E,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,KAAK,QAAQ,GACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,aAAa,EACb,oBAAoB,EACpB,KAAK,aAAa,EAClB,UAAU,EACV,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,cAAc,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -55,6 +55,12 @@ export { useObjectUrl } from './useObjectUrl.js';
|
|
|
55
55
|
// element rather than Vidstack and each was carrying its own copy of the decision.
|
|
56
56
|
export { attachHlsSource, canPlayHlsNatively, useHlsSource } from './hlsSource.js';
|
|
57
57
|
export { PLAYBACK_RATES, preferBundledHls, VideoPlayer } from './VideoPlayer.js';
|
|
58
|
+
export { VideoQualitySelect } from './VideoQualitySelect.js';
|
|
59
|
+
// The image half of it — the web copy, and the original past it, remembered per viewer
|
|
60
|
+
// (forge task 3873); an image viewer draws the `src` the hook answers and hands it the toggle.
|
|
61
|
+
export { originalUndrawableReason } from './imageOriginal.js';
|
|
62
|
+
export { ImageOriginalToggle } from './ImageOriginalToggle.js';
|
|
63
|
+
export { useImageOriginal } from './useImageOriginal.js';
|
|
58
64
|
// The focus viewer — look closely at PART of a video, and keep what you find. Lifted out
|
|
59
65
|
// of apps/collections in unit 15 so binary-server's inspector can mount the same one.
|
|
60
66
|
export { FocusViewer, } from './FocusViewer.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/media/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,gFAAgF;AAChF,+EAA+E;AAC/E,oFAAoF;AACpF,uFAAuF;AACvF,yEAAyE;AACzE,EAAE;AACF,2GAA2G;AAE3G,OAAO,EAEL,gBAAgB,GAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAA+B,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAA4B,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,kBAAkB,EAIlB,iBAAiB,EAEjB,mBAAmB,GAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EAEd,iBAAiB,EAGjB,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EAMtB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,GAKvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAmD,MAAM,oBAAoB,CAAC;AACpG;;;;GAIG;AACH,OAAO,EACL,WAAW,GAIZ,MAAM,kBAA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,CAAC;AACtF,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ImageOriginalControl } from './imageOriginal.js';
|
|
2
|
+
export interface UseImageOriginalOptions {
|
|
3
|
+
/** The web copy — what is drawn until the original is wanted AND decoded. */
|
|
4
|
+
src: string;
|
|
5
|
+
/** The original, signed for inline viewing. Absent: there is no original to reach, and no control. */
|
|
6
|
+
originalSrc?: string | null | undefined;
|
|
7
|
+
mime?: string | null | undefined;
|
|
8
|
+
name?: string | null | undefined;
|
|
9
|
+
/** The picture's width on screen in CSS pixels, zoom included; 0 while unknown. */
|
|
10
|
+
drawnWidth: number;
|
|
11
|
+
/** The web copy's own pixel width (`naturalWidth`); 0 while unknown. */
|
|
12
|
+
webWidth: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ImageOriginal {
|
|
15
|
+
/** The URL to draw. */
|
|
16
|
+
src: string;
|
|
17
|
+
/** Null when the item carries no original. */
|
|
18
|
+
control: ImageOriginalControl | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function useImageOriginal({ src, originalSrc, mime, name, drawnWidth, webWidth }: UseImageOriginalOptions): ImageOriginal;
|
|
21
|
+
//# sourceMappingURL=useImageOriginal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImageOriginal.d.ts","sourceRoot":"","sources":["../../../src/react/media/useImageOriginal.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,oBAAoB,EAM1B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;IAC9C,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACtC;AAUD,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,aAAa,CAkD/H"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web copy, and the original past it — `imageOriginal.ts` says what the choices mean.
|
|
3
|
+
*
|
|
4
|
+
* A viewer hands this what it already knows — the two URLs, the picture's type, how wide it is
|
|
5
|
+
* DRAWN right now (zoom included), and how wide the web copy is — and draws the `src` it
|
|
6
|
+
* answers. Nothing here measures the DOM: the gallery stage measures its `<img>`, photos' zoom
|
|
7
|
+
* multiplies its fit by its scale, and either way the decision is the same pure comparison.
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
10
|
+
import { ORIGINAL_FAILED_REASON, originalNeeded, originalUndrawableReason, readImageOriginalPinned, writeImageOriginalPinned, } from './imageOriginal.js';
|
|
11
|
+
/** Off-screen fetch AND decode, so the swap is one frame. The browser's cache serves the `<img>` after. */
|
|
12
|
+
function decodeOff(url) {
|
|
13
|
+
const image = new Image();
|
|
14
|
+
image.decoding = 'async';
|
|
15
|
+
image.src = url;
|
|
16
|
+
return image.decode();
|
|
17
|
+
}
|
|
18
|
+
export function useImageOriginal({ src, originalSrc, mime, name, drawnWidth, webWidth }) {
|
|
19
|
+
const [pinned, setPinned] = useState(readImageOriginalPinned);
|
|
20
|
+
/** The original that has decoded and may be drawn — keyed by URL, so a new picture starts over. */
|
|
21
|
+
const [ready, setReady] = useState(null);
|
|
22
|
+
const [failed, setFailed] = useState(null);
|
|
23
|
+
/**
|
|
24
|
+
* 🔴 Latched per original: once a zoom has fetched it, zooming back out keeps it. The bytes
|
|
25
|
+
* are already here, and swapping back to the web copy would only flicker.
|
|
26
|
+
*/
|
|
27
|
+
const [reached, setReached] = useState(null);
|
|
28
|
+
const original = originalSrc || null;
|
|
29
|
+
const undrawable = original ? originalUndrawableReason(mime, name) : null;
|
|
30
|
+
const unavailable = undrawable ?? (original && failed === original ? ORIGINAL_FAILED_REASON : null);
|
|
31
|
+
const ratio = typeof window === 'undefined' ? 1 : window.devicePixelRatio || 1;
|
|
32
|
+
const needed = originalNeeded(drawnWidth, webWidth, ratio);
|
|
33
|
+
const wanted = Boolean(original) && !unavailable && (pinned || needed || reached === original);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (wanted && original && reached !== original)
|
|
36
|
+
setReached(original);
|
|
37
|
+
}, [wanted, original, reached]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!wanted || !original || ready === original)
|
|
40
|
+
return;
|
|
41
|
+
let live = true;
|
|
42
|
+
decodeOff(original).then(() => live && setReady(original), () => live && setFailed(original));
|
|
43
|
+
return () => {
|
|
44
|
+
live = false;
|
|
45
|
+
};
|
|
46
|
+
}, [wanted, original, ready]);
|
|
47
|
+
const toggle = useCallback(() => {
|
|
48
|
+
setPinned((was) => {
|
|
49
|
+
writeImageOriginalPinned(!was);
|
|
50
|
+
return !was;
|
|
51
|
+
});
|
|
52
|
+
// Un-pinning returns to the web copy unless the zoom still needs the original.
|
|
53
|
+
setReached(null);
|
|
54
|
+
}, []);
|
|
55
|
+
const showing = Boolean(original) && wanted && ready === original;
|
|
56
|
+
return {
|
|
57
|
+
src: showing && original ? original : src,
|
|
58
|
+
control: original
|
|
59
|
+
? { pinned, showing, loading: wanted && !showing, unavailable, toggle }
|
|
60
|
+
: null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=useImageOriginal.js.map
|
|
@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AC;YAC/B,OAAO,CAAC,GAAG,CAAC;QACd,CAAC,CAAC,CAAC;QACH,+EAA+E;QAC/E,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,MAAM,IAAI,KAAK,KAAK,QAAQ,CAAC;IAClE,OAAO;QACL,GAAG,EAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;QACzC,OAAO,EAAE,QAAQ;YACf,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE;YACvE,CAAC,CAAC,IAAI;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* ── 🔴 Upscaling is HONEST here, and deliberately modest ───────────────────────────────
|
|
20
20
|
* There is no detail in a video frame that was not decoded, so nothing here can invent any.
|
|
21
21
|
* What upscaling buys is real but narrow: a 300×200 crop of a 4K frame saved at 1× is a tiny
|
|
22
|
-
* picture that every later viewer scales up with nearest-
|
|
22
|
+
* picture that every later viewer scales up with nearest-neighbor-ish defaults, whereas
|
|
23
23
|
* resampling it once, at capture, with `imageSmoothingQuality: 'high'`, produces a smoother
|
|
24
24
|
* enlargement than each viewer would make for itself. So the ceiling is low on purpose — 4×
|
|
25
25
|
* is already past the point of adding anything, and beyond that it is only file size.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* ── 🔴 Upscaling is HONEST here, and deliberately modest ───────────────────────────────
|
|
20
20
|
* There is no detail in a video frame that was not decoded, so nothing here can invent any.
|
|
21
21
|
* What upscaling buys is real but narrow: a 300×200 crop of a 4K frame saved at 1× is a tiny
|
|
22
|
-
* picture that every later viewer scales up with nearest-
|
|
22
|
+
* picture that every later viewer scales up with nearest-neighbor-ish defaults, whereas
|
|
23
23
|
* resampling it once, at capture, with `imageSmoothingQuality: 'high'`, produces a smoother
|
|
24
24
|
* enlargement than each viewer would make for itself. So the ceiling is low on purpose — 4×
|
|
25
25
|
* is already past the point of adding anything, and beyond that it is only file size.
|
|
@@ -70,3 +70,26 @@
|
|
|
70
70
|
--media-sm-fullscreen-button-size: 44px;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* ── The quality menu (forge task 3868) ────────────────────────────────────────────────
|
|
76
|
+
* cursedbelt's own (`VideoQualitySelect`, in the bar beside the cog) REPLACES Vidstack's
|
|
77
|
+
* quality submenu: that one offers no Max and remembers nothing, and two menus choosing the
|
|
78
|
+
* same thing would disagree. This stylesheet ships only with `VideoPlayer`, which always
|
|
79
|
+
* draws the replacement, so hiding Vidstack's here cannot leave a player with neither.
|
|
80
|
+
*/
|
|
81
|
+
.vds-quality-menu {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
.cbvp-quality {
|
|
85
|
+
align-self: center;
|
|
86
|
+
color: inherit;
|
|
87
|
+
font-size: 13px;
|
|
88
|
+
}
|
|
89
|
+
/* The trigger is as tall as the bar's own buttons — 44px on a finger (the coarse block above
|
|
90
|
+
sets `--media-button-size`), so the chip clears the same tap floor they do. */
|
|
91
|
+
.cbvp-quality button {
|
|
92
|
+
min-height: var(--media-button-size, 40px);
|
|
93
|
+
min-width: 44px;
|
|
94
|
+
padding-inline: 6px;
|
|
95
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A video's quality choice — YouTube's menu: Auto · Max · each rung — remembered per viewer.
|
|
3
|
+
*
|
|
4
|
+
* ── Why the choice exists (forge task 3868, the owner's ruling of 2026-10-28) ─────────────
|
|
5
|
+
* A ladder's top rung is now the ORIGINAL's own stream wherever the browser can play it
|
|
6
|
+
* (binary-server's `planLadder`: an `o<height>` rung is a stream copy, no loss). hls.js was
|
|
7
|
+
* capped to the player's size (`capLevelToPlayerSize`, task 3219 — *"lower bandwidth usage"*),
|
|
8
|
+
* so a windowed player played 480/720 on any connection, which is the blur the owner kept
|
|
9
|
+
* seeing. Both wishes stand, so they became two choices instead of one setting:
|
|
10
|
+
*
|
|
11
|
+
* | choice | what hls.js does |
|
|
12
|
+
* |---|---|
|
|
13
|
+
* | `auto` | adapts to bandwidth, never above what the player can show (the cap ON) |
|
|
14
|
+
* | `max` | adapts to bandwidth, up to the original, whatever the player's size (the cap OFF) |
|
|
15
|
+
* | a height | that rung, fixed — the nearest rung at or below it on a film without it |
|
|
16
|
+
*
|
|
17
|
+
* ── 🔴 Remembered as a HEIGHT, never as a level index ──────────────────────────────────
|
|
18
|
+
* Every film has its own ladder: index 3 is 1080p on one and the 2160 original on the next.
|
|
19
|
+
* A height means the same thing on every film, and a film whose ladder has no such rung takes
|
|
20
|
+
* the nearest one below it (`levelIndexFor`) — "1080p" on a 720p film is its 720p, not
|
|
21
|
+
* nothing.
|
|
22
|
+
*
|
|
23
|
+
* ── 🔴 Per VIEWER, so `localStorage` ───────────────────────────────────────────────────
|
|
24
|
+
* A phone on cellular and the TV want different answers, and a viewer's device is where the
|
|
25
|
+
* answer belongs; a server-side preference would hand the TV's "Max" to the phone. Every
|
|
26
|
+
* surface reads the one key, so a choice made in the gallery stage carries into the focus
|
|
27
|
+
* viewer and the next film.
|
|
28
|
+
*
|
|
29
|
+
* ── Native HLS cannot choose ────────────────────────────────────────────────────────────
|
|
30
|
+
* Safari and every iPhone play the ladder with no library, and a page has no API to pick a
|
|
31
|
+
* rung there — the browser adapts by itself. The control stays VISIBLE and disabled, with the
|
|
32
|
+
* reason (`NATIVE_HLS_REASON`), per the fleet's one-UI rule.
|
|
33
|
+
*/
|
|
34
|
+
/** `auto`, `max`, or a rung's height in pixels. */
|
|
35
|
+
export type VideoQualityChoice = 'auto' | 'max' | number;
|
|
36
|
+
/** The one key every player reads and writes. */
|
|
37
|
+
export declare const VIDEO_QUALITY_KEY = "cb.video-quality";
|
|
38
|
+
export declare const NATIVE_HLS_REASON = "This browser plays the stream itself and picks the quality on its own \u2014 Safari and iPhone let a page choose nothing";
|
|
39
|
+
export declare const NO_LADDER_REASON = "This video has one quality: it is playing the file itself, not a ladder";
|
|
40
|
+
/** The stored string back into a choice. Anything unreadable is `auto`, the safe default. */
|
|
41
|
+
export declare function parseVideoQuality(raw: string | null | undefined): VideoQualityChoice;
|
|
42
|
+
export declare function serializeVideoQuality(choice: VideoQualityChoice): string;
|
|
43
|
+
export declare function readVideoQuality(): VideoQualityChoice;
|
|
44
|
+
export declare function writeVideoQuality(choice: VideoQualityChoice): void;
|
|
45
|
+
/** One rung, as a menu offers it. */
|
|
46
|
+
export interface VideoQualityLevel {
|
|
47
|
+
height: number;
|
|
48
|
+
/** The original's own stream (binary-server's `o<height>` rung), not an encode. */
|
|
49
|
+
original: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The fields this module reads off an hls.js `Level` — declared here so hls.js stays a lazy chunk. */
|
|
52
|
+
export interface HlsLevelLike {
|
|
53
|
+
height?: number;
|
|
54
|
+
uri?: string;
|
|
55
|
+
url?: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
/** The ladder's rungs, tallest first, one per height. */
|
|
58
|
+
export declare function rungLevels(levels: readonly HlsLevelLike[]): VideoQualityLevel[];
|
|
59
|
+
/**
|
|
60
|
+
* The hls.js level a choice plays: `-1` (adaptive) for `auto` and `max`, else the rung of that
|
|
61
|
+
* height — or the tallest below it, or the shortest when every rung is taller.
|
|
62
|
+
*/
|
|
63
|
+
export declare function levelIndexFor(levels: readonly HlsLevelLike[], choice: VideoQualityChoice): number;
|
|
64
|
+
/** What a player surface shows, and the one way to change it. */
|
|
65
|
+
export interface VideoQualityControl {
|
|
66
|
+
/** The ladder's rungs, tallest first. Empty when nothing can be chosen. */
|
|
67
|
+
levels: VideoQualityLevel[];
|
|
68
|
+
choice: VideoQualityChoice;
|
|
69
|
+
/** The rung on screen right now, when known — what "Auto" is showing. */
|
|
70
|
+
playingHeight: number | null;
|
|
71
|
+
/** Why nothing can be chosen here, or null when the menu works. */
|
|
72
|
+
unavailable: string | null;
|
|
73
|
+
/** Apply AND remember. */
|
|
74
|
+
select: (choice: VideoQualityChoice) => void;
|
|
75
|
+
}
|
|
76
|
+
/** A control that can choose nothing, with the reason. */
|
|
77
|
+
export declare function unavailableQuality(reason: string): VideoQualityControl;
|
|
78
|
+
/** The slice of an hls.js instance this module drives. */
|
|
79
|
+
export interface HlsQualityEngine {
|
|
80
|
+
levels: readonly HlsLevelLike[] | undefined;
|
|
81
|
+
currentLevel: number;
|
|
82
|
+
nextLevel: number;
|
|
83
|
+
capLevelToPlayerSize: boolean;
|
|
84
|
+
on: (event: string, listener: (...args: never[]) => void) => void;
|
|
85
|
+
off: (event: string, listener: (...args: never[]) => void) => void;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Drive `hls` by the viewer's remembered choice, and report it.
|
|
89
|
+
*
|
|
90
|
+
* The cap is set before the first fragment (a `max` viewer never loads a capped first rung),
|
|
91
|
+
* and a fixed rung is applied when the manifest is parsed — the first moment the levels exist.
|
|
92
|
+
* A later choice switches with `nextLevel`: the next fragment plays the new rung, and what is
|
|
93
|
+
* already buffered still plays, so changing quality never stalls the picture.
|
|
94
|
+
*
|
|
95
|
+
* Returns the unbind. `engine.destroy()` drops the listeners too; the unbind is for a surface
|
|
96
|
+
* that keeps the engine.
|
|
97
|
+
*/
|
|
98
|
+
export declare function bindHlsQuality(hls: HlsQualityEngine, onChange: (control: VideoQualityControl) => void): () => void;
|
|
99
|
+
/** A rung's menu label: `2160p · Original`, `720p`. */
|
|
100
|
+
export declare function rungLabel(level: VideoQualityLevel): string;
|
|
101
|
+
/**
|
|
102
|
+
* A quality control held OUTSIDE React state, for a surface whose menu lives in a slot it must
|
|
103
|
+
* not rebuild: Vidstack's layout remounts whenever its `slots` object changes (`VideoPlayer`'s
|
|
104
|
+
* memo says why), and the control changes on every rung switch. The slot reads this store with
|
|
105
|
+
* `useSyncExternalStore`, so a switch re-renders the menu and nothing else.
|
|
106
|
+
*/
|
|
107
|
+
export interface VideoQualityStore {
|
|
108
|
+
get: () => VideoQualityControl | null;
|
|
109
|
+
set: (control: VideoQualityControl | null) => void;
|
|
110
|
+
subscribe: (listener: () => void) => () => void;
|
|
111
|
+
}
|
|
112
|
+
export declare function createVideoQualityStore(): VideoQualityStore;
|
|
113
|
+
//# sourceMappingURL=videoQuality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"videoQuality.d.ts","sourceRoot":"","sources":["../../../src/react/media/videoQuality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,mDAAmD;AACnD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzD,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,6HACyF,CAAC;AACxH,eAAO,MAAM,gBAAgB,4EAA4E,CAAC;AAE1G,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,kBAAkB,CAIpF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAExE;AAWD,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAMlE;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC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CAyCZ;AAED,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAE1D;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,GAAG,EAAE,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CACjD;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAc3D"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A video's quality choice — YouTube's menu: Auto · Max · each rung — remembered per viewer.
|
|
3
|
+
*
|
|
4
|
+
* ── Why the choice exists (forge task 3868, the owner's ruling of 2026-10-28) ─────────────
|
|
5
|
+
* A ladder's top rung is now the ORIGINAL's own stream wherever the browser can play it
|
|
6
|
+
* (binary-server's `planLadder`: an `o<height>` rung is a stream copy, no loss). hls.js was
|
|
7
|
+
* capped to the player's size (`capLevelToPlayerSize`, task 3219 — *"lower bandwidth usage"*),
|
|
8
|
+
* so a windowed player played 480/720 on any connection, which is the blur the owner kept
|
|
9
|
+
* seeing. Both wishes stand, so they became two choices instead of one setting:
|
|
10
|
+
*
|
|
11
|
+
* | choice | what hls.js does |
|
|
12
|
+
* |---|---|
|
|
13
|
+
* | `auto` | adapts to bandwidth, never above what the player can show (the cap ON) |
|
|
14
|
+
* | `max` | adapts to bandwidth, up to the original, whatever the player's size (the cap OFF) |
|
|
15
|
+
* | a height | that rung, fixed — the nearest rung at or below it on a film without it |
|
|
16
|
+
*
|
|
17
|
+
* ── 🔴 Remembered as a HEIGHT, never as a level index ──────────────────────────────────
|
|
18
|
+
* Every film has its own ladder: index 3 is 1080p on one and the 2160 original on the next.
|
|
19
|
+
* A height means the same thing on every film, and a film whose ladder has no such rung takes
|
|
20
|
+
* the nearest one below it (`levelIndexFor`) — "1080p" on a 720p film is its 720p, not
|
|
21
|
+
* nothing.
|
|
22
|
+
*
|
|
23
|
+
* ── 🔴 Per VIEWER, so `localStorage` ───────────────────────────────────────────────────
|
|
24
|
+
* A phone on cellular and the TV want different answers, and a viewer's device is where the
|
|
25
|
+
* answer belongs; a server-side preference would hand the TV's "Max" to the phone. Every
|
|
26
|
+
* surface reads the one key, so a choice made in the gallery stage carries into the focus
|
|
27
|
+
* viewer and the next film.
|
|
28
|
+
*
|
|
29
|
+
* ── Native HLS cannot choose ────────────────────────────────────────────────────────────
|
|
30
|
+
* Safari and every iPhone play the ladder with no library, and a page has no API to pick a
|
|
31
|
+
* rung there — the browser adapts by itself. The control stays VISIBLE and disabled, with the
|
|
32
|
+
* reason (`NATIVE_HLS_REASON`), per the fleet's one-UI rule.
|
|
33
|
+
*/
|
|
34
|
+
/** The one key every player reads and writes. */
|
|
35
|
+
export const VIDEO_QUALITY_KEY = 'cb.video-quality';
|
|
36
|
+
export const NATIVE_HLS_REASON = 'This browser plays the stream itself and picks the quality on its own — Safari and iPhone let a page choose nothing';
|
|
37
|
+
export const NO_LADDER_REASON = 'This video has one quality: it is playing the file itself, not a ladder';
|
|
38
|
+
/** The stored string back into a choice. Anything unreadable is `auto`, the safe default. */
|
|
39
|
+
export function parseVideoQuality(raw) {
|
|
40
|
+
if (raw === 'max')
|
|
41
|
+
return 'max';
|
|
42
|
+
const height = Number(raw);
|
|
43
|
+
return Number.isInteger(height) && height > 0 ? height : 'auto';
|
|
44
|
+
}
|
|
45
|
+
export function serializeVideoQuality(choice) {
|
|
46
|
+
return typeof choice === 'number' ? String(choice) : choice;
|
|
47
|
+
}
|
|
48
|
+
/** Guarded: storage throws in a private window, and is absent in a worker or on the server. */
|
|
49
|
+
function store() {
|
|
50
|
+
try {
|
|
51
|
+
return globalThis.localStorage ?? null;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function readVideoQuality() {
|
|
58
|
+
try {
|
|
59
|
+
return parseVideoQuality(store()?.getItem(VIDEO_QUALITY_KEY));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return 'auto';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function writeVideoQuality(choice) {
|
|
66
|
+
try {
|
|
67
|
+
store()?.setItem(VIDEO_QUALITY_KEY, serializeVideoQuality(choice));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
/* a full or refused store only means the choice lasts this film */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** A rung playlist under an `o<height>/` directory is the original's stream copy. */
|
|
74
|
+
const ORIGINAL_RUNG = /(^|\/)o\d+\/[^/]*$/;
|
|
75
|
+
/** The ladder's rungs, tallest first, one per height. */
|
|
76
|
+
export function rungLevels(levels) {
|
|
77
|
+
const byHeight = new Map();
|
|
78
|
+
for (const level of levels) {
|
|
79
|
+
const height = level.height ?? 0;
|
|
80
|
+
if (height <= 0)
|
|
81
|
+
continue;
|
|
82
|
+
const uri = (level.uri ?? level.url?.[0] ?? '').split('?')[0] ?? '';
|
|
83
|
+
const original = ORIGINAL_RUNG.test(uri);
|
|
84
|
+
const had = byHeight.get(height);
|
|
85
|
+
byHeight.set(height, { height, original: original || (had?.original ?? false) });
|
|
86
|
+
}
|
|
87
|
+
return [...byHeight.values()].sort((a, b) => b.height - a.height);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The hls.js level a choice plays: `-1` (adaptive) for `auto` and `max`, else the rung of that
|
|
91
|
+
* height — or the tallest below it, or the shortest when every rung is taller.
|
|
92
|
+
*/
|
|
93
|
+
export function levelIndexFor(levels, choice) {
|
|
94
|
+
if (typeof choice !== 'number' || levels.length === 0)
|
|
95
|
+
return -1;
|
|
96
|
+
let best = -1;
|
|
97
|
+
let shortest = -1;
|
|
98
|
+
levels.forEach((level, index) => {
|
|
99
|
+
const height = level.height ?? 0;
|
|
100
|
+
if (shortest === -1 || height < (levels[shortest]?.height ?? 0))
|
|
101
|
+
shortest = index;
|
|
102
|
+
if (height <= choice && (best === -1 || height > (levels[best]?.height ?? 0)))
|
|
103
|
+
best = index;
|
|
104
|
+
});
|
|
105
|
+
return best === -1 ? shortest : best;
|
|
106
|
+
}
|
|
107
|
+
/** A control that can choose nothing, with the reason. */
|
|
108
|
+
export function unavailableQuality(reason) {
|
|
109
|
+
return { levels: [], choice: readVideoQuality(), playingHeight: null, unavailable: reason, select: writeVideoQuality };
|
|
110
|
+
}
|
|
111
|
+
/** hls.js's event names, as strings, so this module never imports the library. */
|
|
112
|
+
const MANIFEST_PARSED = 'hlsManifestParsed';
|
|
113
|
+
const LEVEL_SWITCHED = 'hlsLevelSwitched';
|
|
114
|
+
/**
|
|
115
|
+
* Drive `hls` by the viewer's remembered choice, and report it.
|
|
116
|
+
*
|
|
117
|
+
* The cap is set before the first fragment (a `max` viewer never loads a capped first rung),
|
|
118
|
+
* and a fixed rung is applied when the manifest is parsed — the first moment the levels exist.
|
|
119
|
+
* A later choice switches with `nextLevel`: the next fragment plays the new rung, and what is
|
|
120
|
+
* already buffered still plays, so changing quality never stalls the picture.
|
|
121
|
+
*
|
|
122
|
+
* Returns the unbind. `engine.destroy()` drops the listeners too; the unbind is for a surface
|
|
123
|
+
* that keeps the engine.
|
|
124
|
+
*/
|
|
125
|
+
export function bindHlsQuality(hls, onChange) {
|
|
126
|
+
let choice = readVideoQuality();
|
|
127
|
+
let playingHeight = null;
|
|
128
|
+
// Read through this: an engine that has not parsed a manifest (or a spec's fake) has none.
|
|
129
|
+
const levels = () => hls.levels ?? [];
|
|
130
|
+
hls.capLevelToPlayerSize = choice === 'auto';
|
|
131
|
+
const emit = () => onChange({
|
|
132
|
+
levels: rungLevels(levels()),
|
|
133
|
+
choice,
|
|
134
|
+
playingHeight,
|
|
135
|
+
unavailable: levels().length > 1 ? null : NO_LADDER_REASON,
|
|
136
|
+
select,
|
|
137
|
+
});
|
|
138
|
+
const select = (next) => {
|
|
139
|
+
choice = next;
|
|
140
|
+
writeVideoQuality(next);
|
|
141
|
+
hls.capLevelToPlayerSize = next === 'auto';
|
|
142
|
+
hls.nextLevel = levelIndexFor(levels(), next);
|
|
143
|
+
emit();
|
|
144
|
+
};
|
|
145
|
+
const onParsed = () => {
|
|
146
|
+
const index = levelIndexFor(levels(), choice);
|
|
147
|
+
if (index !== -1)
|
|
148
|
+
hls.currentLevel = index;
|
|
149
|
+
emit();
|
|
150
|
+
};
|
|
151
|
+
const onSwitched = (_event, data) => {
|
|
152
|
+
const level = typeof data?.level === 'number' ? levels()[data.level] : undefined;
|
|
153
|
+
playingHeight = level?.height ?? null;
|
|
154
|
+
emit();
|
|
155
|
+
};
|
|
156
|
+
hls.on(MANIFEST_PARSED, onParsed);
|
|
157
|
+
hls.on(LEVEL_SWITCHED, onSwitched);
|
|
158
|
+
if (levels().length > 0)
|
|
159
|
+
emit();
|
|
160
|
+
return () => {
|
|
161
|
+
hls.off(MANIFEST_PARSED, onParsed);
|
|
162
|
+
hls.off(LEVEL_SWITCHED, onSwitched);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** A rung's menu label: `2160p · Original`, `720p`. */
|
|
166
|
+
export function rungLabel(level) {
|
|
167
|
+
return level.original ? `${level.height}p · Original` : `${level.height}p`;
|
|
168
|
+
}
|
|
169
|
+
export function createVideoQualityStore() {
|
|
170
|
+
let current = null;
|
|
171
|
+
const listeners = new Set();
|
|
172
|
+
return {
|
|
173
|
+
get: () => current,
|
|
174
|
+
set: (control) => {
|
|
175
|
+
current = control;
|
|
176
|
+
for (const listener of listeners)
|
|
177
|
+
listener();
|
|
178
|
+
},
|
|
179
|
+
subscribe: (listener) => {
|
|
180
|
+
listeners.add(listener);
|
|
181
|
+
return () => listeners.delete(listener);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=videoQuality.js.map
|
|
@@ -0,0 +1 @@
|
|
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QAAQ,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,CAAC,cAAc,EAAE,UAAwC,CAAC,CAAC;IACjE,IAAI,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,EAAE,CAAC;IAChC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QACnC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,UAAwC,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,SAAS,CAAC,KAAwB;IAChD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;AAC7E,CAAC;AAcD,MAAM,UAAU,uBAAuB;IACrC,IAAI,OAAO,GAA+B,IAAI,CAAC;IAC/C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IACxC,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO;QAClB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;YACf,OAAO,GAAG,OAAO,CAAC;YAClB,KAAK,MAAM,QAAQ,IAAI,SAAS;gBAAE,QAAQ,EAAE,CAAC;QAC/C,CAAC;QACD,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;YACtB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The quality menu on cursedbelt's Vidstack player (forge task 3868) — kept out of
|
|
3
|
+
* `VideoPlayer.tsx` so the `./react/media/video-player` subpath exports what it always did.
|
|
4
|
+
*/
|
|
5
|
+
import { type MediaProviderAdapter } from '@vidstack/react';
|
|
6
|
+
import type { DefaultVideoLayoutSlots } from '@vidstack/react/player/layouts/default';
|
|
7
|
+
import { type VideoQualityStore } from './videoQuality.js';
|
|
8
|
+
/**
|
|
9
|
+
* The viewer's quality choice on Vidstack's hls.js (forge task 3868) — the same choice, read from
|
|
10
|
+
* the same key, as every `hlsSource.ts` surface (`videoQuality.ts` has what each one means).
|
|
11
|
+
*
|
|
12
|
+
* 🔴 Auto is capped at the player's size HERE TOO. Vidstack's hls.js ran with the library's
|
|
13
|
+
* defaults, so this stage alone fetched the top rung into any size of player; with that rung now
|
|
14
|
+
* the ORIGINAL (a 4K film's is ~20 Mbps), Auto means the same thing on every surface, and Max is
|
|
15
|
+
* the one remembered choice that lifts the cap.
|
|
16
|
+
*
|
|
17
|
+
* Safari's own HLS (Vidstack's plain `VideoProvider` playing a ladder) and the progressive copy
|
|
18
|
+
* can choose nothing, and say why.
|
|
19
|
+
*/
|
|
20
|
+
export declare function bindVidstackQuality(provider: MediaProviderAdapter | null, store: VideoQualityStore, ladder: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Quality beside the settings cog, where YouTube keeps it. It REPLACES Vidstack's own quality
|
|
23
|
+
* submenu (hidden in `videoPlayer.css`): that one has no Max, remembers nothing, and two menus
|
|
24
|
+
* choosing one thing would disagree.
|
|
25
|
+
*/
|
|
26
|
+
export declare function qualitySlots(store: VideoQualityStore): DefaultVideoLayoutSlots;
|
|
27
|
+
//# sourceMappingURL=vidstackQuality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vidstackQuality.d.ts","sourceRoot":"","sources":["../../../src/react/media/vidstackQuality.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEtF,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,EACrC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,OAAO,GACd,IAAI,CAcN;AAQD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,uBAAuB,CAG9E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The quality menu on cursedbelt's Vidstack player (forge task 3868) — kept out of
|
|
4
|
+
* `VideoPlayer.tsx` so the `./react/media/video-player` subpath exports what it always did.
|
|
5
|
+
*/
|
|
6
|
+
import { isHLSProvider } from '@vidstack/react';
|
|
7
|
+
import { useSyncExternalStore } from 'react';
|
|
8
|
+
import { bindHlsQuality, NATIVE_HLS_REASON, NO_LADDER_REASON, readVideoQuality, unavailableQuality, } from './videoQuality.js';
|
|
9
|
+
import { VideoQualitySelect } from './VideoQualitySelect.js';
|
|
10
|
+
/**
|
|
11
|
+
* The viewer's quality choice on Vidstack's hls.js (forge task 3868) — the same choice, read from
|
|
12
|
+
* the same key, as every `hlsSource.ts` surface (`videoQuality.ts` has what each one means).
|
|
13
|
+
*
|
|
14
|
+
* 🔴 Auto is capped at the player's size HERE TOO. Vidstack's hls.js ran with the library's
|
|
15
|
+
* defaults, so this stage alone fetched the top rung into any size of player; with that rung now
|
|
16
|
+
* the ORIGINAL (a 4K film's is ~20 Mbps), Auto means the same thing on every surface, and Max is
|
|
17
|
+
* the one remembered choice that lifts the cap.
|
|
18
|
+
*
|
|
19
|
+
* Safari's own HLS (Vidstack's plain `VideoProvider` playing a ladder) and the progressive copy
|
|
20
|
+
* can choose nothing, and say why.
|
|
21
|
+
*/
|
|
22
|
+
export function bindVidstackQuality(provider, store, ladder) {
|
|
23
|
+
if (!provider) {
|
|
24
|
+
store.set(null);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (isHLSProvider(provider)) {
|
|
28
|
+
store.set(null);
|
|
29
|
+
provider.config = { ...provider.config, capLevelToPlayerSize: readVideoQuality() === 'auto' };
|
|
30
|
+
provider.onInstance((hls) => {
|
|
31
|
+
bindHlsQuality(hls, store.set);
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
store.set(unavailableQuality(ladder ? NATIVE_HLS_REASON : NO_LADDER_REASON));
|
|
36
|
+
}
|
|
37
|
+
/** The quality menu in the bar, re-rendered by the store alone — see `VideoQualityStore`. */
|
|
38
|
+
function QualitySlot({ store }) {
|
|
39
|
+
const control = useSyncExternalStore(store.subscribe, store.get, store.get);
|
|
40
|
+
return _jsx(VideoQualitySelect, { className: 'cbvp-quality', control: control, fieldStyle: false });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Quality beside the settings cog, where YouTube keeps it. It REPLACES Vidstack's own quality
|
|
44
|
+
* submenu (hidden in `videoPlayer.css`): that one has no Max, remembers nothing, and two menus
|
|
45
|
+
* choosing one thing would disagree.
|
|
46
|
+
*/
|
|
47
|
+
export function qualitySlots(store) {
|
|
48
|
+
const pair = { beforeSettingsMenu: _jsx(QualitySlot, { store: store }) };
|
|
49
|
+
return { ...pair, smallLayout: { ...pair }, largeLayout: { ...pair } };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=vidstackQuality.js.map
|