@rixl/media-core 1.0.2 → 1.1.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.
- package/README.md +74 -84
- package/dist/chunks/B-QvSqjj.js +1 -0
- package/dist/chunks/B2DDE32u.js +1 -0
- package/dist/chunks/DMkwQjgA.js +1 -0
- package/dist/index.d.ts +1906 -82
- package/dist/index.js +6 -73
- package/package.json +13 -6
- package/dist/api/analytics.d.ts +0 -16
- package/dist/api/analytics.js +0 -227
- package/dist/api/feed.js +0 -52
- package/dist/api/heatmap.d.ts +0 -6
- package/dist/api/heatmap.js +0 -28
- package/dist/api/hot-segments.d.ts +0 -7
- package/dist/api/hot-segments.js +0 -20
- package/dist/api/image.js +0 -11
- package/dist/api/rixl-client.d.ts +0 -3
- package/dist/api/rixl-client.js +0 -14
- package/dist/api/upload.d.ts +0 -76
- package/dist/api/upload.js +0 -150
- package/dist/api/video.js +0 -11
- package/dist/lib/analytics-builders.d.ts +0 -59
- package/dist/lib/analytics-builders.js +0 -88
- package/dist/lib/analytics-initialize.d.ts +0 -1
- package/dist/lib/analytics-initialize.js +0 -59
- package/dist/lib/analytics-utils.d.ts +0 -43
- package/dist/lib/analytics-utils.js +0 -85
- package/dist/lib/analytics-wire.js +0 -153
- package/dist/lib/buffer-progress.d.ts +0 -20
- package/dist/lib/buffer-progress.js +0 -37
- package/dist/lib/caption-styles.d.ts +0 -20
- package/dist/lib/caption-styles.js +0 -56
- package/dist/lib/caption-utils.d.ts +0 -80
- package/dist/lib/caption-utils.js +0 -111
- package/dist/lib/chapter-utils.d.ts +0 -102
- package/dist/lib/chapter-utils.js +0 -147
- package/dist/lib/click-disambiguation.d.ts +0 -44
- package/dist/lib/click-disambiguation.js +0 -80
- package/dist/lib/click-outside.d.ts +0 -68
- package/dist/lib/click-outside.js +0 -64
- package/dist/lib/colors.d.ts +0 -6
- package/dist/lib/colors.js +0 -16
- package/dist/lib/content-analytics.d.ts +0 -27
- package/dist/lib/content-analytics.js +0 -38
- package/dist/lib/environment-effects.d.ts +0 -89
- package/dist/lib/environment-effects.js +0 -139
- package/dist/lib/feed-autoscroll.d.ts +0 -10
- package/dist/lib/feed-autoscroll.js +0 -13
- package/dist/lib/feed-container-height.d.ts +0 -7
- package/dist/lib/feed-container-height.js +0 -11
- package/dist/lib/feed-description-overflow.d.ts +0 -1
- package/dist/lib/feed-description-overflow.js +0 -9
- package/dist/lib/feed-dwell.d.ts +0 -2
- package/dist/lib/feed-dwell.js +0 -8
- package/dist/lib/feed-loop.d.ts +0 -10
- package/dist/lib/feed-loop.js +0 -21
- package/dist/lib/feed-scroll.d.ts +0 -11
- package/dist/lib/feed-scroll.js +0 -19
- package/dist/lib/feed-transforms.d.ts +0 -5
- package/dist/lib/feed-transforms.js +0 -30
- package/dist/lib/filter-undefined.js +0 -11
- package/dist/lib/fullscreen-utils.d.ts +0 -1
- package/dist/lib/fullscreen-utils.js +0 -7
- package/dist/lib/hls-buffer-flush.js +0 -46
- package/dist/lib/hls-error-recovery.d.ts +0 -35
- package/dist/lib/hls-error-recovery.js +0 -75
- package/dist/lib/hls-event-handlers.js +0 -61
- package/dist/lib/hls-loader.js +0 -23
- package/dist/lib/hls-setup.d.ts +0 -72
- package/dist/lib/hls-setup.js +0 -144
- package/dist/lib/hls-utils.d.ts +0 -31
- package/dist/lib/hls-utils.js +0 -34
- package/dist/lib/image-render.d.ts +0 -29
- package/dist/lib/image-render.js +0 -63
- package/dist/lib/keyboard-config.d.ts +0 -66
- package/dist/lib/keyboard-config.js +0 -127
- package/dist/lib/keyboard-utils.d.ts +0 -4
- package/dist/lib/keyboard-utils.js +0 -11
- package/dist/lib/lifecycle-effects.d.ts +0 -67
- package/dist/lib/lifecycle-effects.js +0 -78
- package/dist/lib/loading-debounce.d.ts +0 -26
- package/dist/lib/loading-debounce.js +0 -38
- package/dist/lib/numbers.d.ts +0 -6
- package/dist/lib/numbers.js +0 -36
- package/dist/lib/pip-utils.d.ts +0 -16
- package/dist/lib/pip-utils.js +0 -32
- package/dist/lib/playback-handlers.d.ts +0 -33
- package/dist/lib/playback-handlers.js +0 -51
- package/dist/lib/playback-slider.d.ts +0 -23
- package/dist/lib/playback-slider.js +0 -24
- package/dist/lib/player-labels.d.ts +0 -23
- package/dist/lib/player-labels.js +0 -132
- package/dist/lib/player-menu-labels.d.ts +0 -80
- package/dist/lib/player-menu-labels.js +0 -829
- package/dist/lib/player-ui-actions.d.ts +0 -10
- package/dist/lib/player-ui-actions.js +0 -58
- package/dist/lib/progress-fraction.d.ts +0 -11
- package/dist/lib/progress-fraction.js +0 -20
- package/dist/lib/progress-persist.d.ts +0 -28
- package/dist/lib/progress-persist.js +0 -54
- package/dist/lib/segment-analytics.d.ts +0 -20
- package/dist/lib/segment-analytics.js +0 -29
- package/dist/lib/subtitle-logic.d.ts +0 -31
- package/dist/lib/subtitle-logic.js +0 -75
- package/dist/lib/subtitle-utils.d.ts +0 -16
- package/dist/lib/subtitle-utils.js +0 -37
- package/dist/lib/time.d.ts +0 -1
- package/dist/lib/time.js +0 -17
- package/dist/lib/track-persistence.d.ts +0 -4
- package/dist/lib/track-persistence.js +0 -35
- package/dist/lib/video-preload-config.d.ts +0 -34
- package/dist/lib/video-preload-config.js +0 -41
- package/dist/lib/video-spinner.d.ts +0 -25
- package/dist/lib/video-spinner.js +0 -35
- package/dist/lib/video-stats.d.ts +0 -28
- package/dist/lib/video-stats.js +0 -44
- package/dist/lib/volume-utils.d.ts +0 -59
- package/dist/lib/volume-utils.js +0 -55
- package/dist/progressbar.d.ts +0 -10
- package/dist/progressbar.js +0 -125
- package/dist/store/analytics-context-store.d.ts +0 -4
- package/dist/store/analytics-context-store.js +0 -13
- package/dist/store/analytics-device-store.d.ts +0 -8
- package/dist/store/analytics-device-store.js +0 -44
- package/dist/store/analytics-session-store.d.ts +0 -8
- package/dist/store/analytics-session-store.js +0 -40
- package/dist/store/analytics-store.d.ts +0 -30
- package/dist/store/analytics-store.js +0 -88
- package/dist/store/controls-store.d.ts +0 -16
- package/dist/store/controls-store.js +0 -53
- package/dist/store/feed-cache-store.d.ts +0 -24
- package/dist/store/feed-cache-store.js +0 -165
- package/dist/store/feed-interaction-store.d.ts +0 -17
- package/dist/store/feed-interaction-store.js +0 -32
- package/dist/store/feed-store.d.ts +0 -16
- package/dist/store/feed-store.js +0 -38
- package/dist/store/generic-store.js +0 -24
- package/dist/store/image-store.d.ts +0 -2
- package/dist/store/image-store.js +0 -8
- package/dist/store/player-container-element-store.d.ts +0 -10
- package/dist/store/player-container-element-store.js +0 -38
- package/dist/store/player-global-actions.js +0 -53
- package/dist/store/player-media-element-store.d.ts +0 -10
- package/dist/store/player-media-element-store.js +0 -38
- package/dist/store/player-store-actions.js +0 -197
- package/dist/store/player-store.d.ts +0 -94
- package/dist/store/player-store.js +0 -127
- package/dist/store/player-track-actions.js +0 -44
- package/dist/store/postStore.d.ts +0 -20
- package/dist/store/postStore.js +0 -112
- package/dist/store/settings/constants.d.ts +0 -15
- package/dist/store/settings/constants.js +0 -47
- package/dist/store/settings/defaults.d.ts +0 -2
- package/dist/store/settings/defaults.js +0 -24
- package/dist/store/settings/storage.d.ts +0 -3
- package/dist/store/settings/storage.js +0 -28
- package/dist/store/settings/store.d.ts +0 -32
- package/dist/store/settings/store.js +0 -59
- package/dist/store/settings/types.d.ts +0 -27
- package/dist/store/settings/validation.d.ts +0 -7
- package/dist/store/settings/validation.js +0 -55
- package/dist/store/settings-menu-store.d.ts +0 -19
- package/dist/store/settings-menu-store.js +0 -30
- package/dist/store/video-store.d.ts +0 -2
- package/dist/store/video-store.js +0 -8
- package/dist/types/analytics.d.ts +0 -113
- package/dist/types/feed.d.ts +0 -21
- package/dist/types/file.d.ts +0 -12
- package/dist/types/heatmap.d.ts +0 -5
- package/dist/types/hot-segments.d.ts +0 -9
- package/dist/types/image.d.ts +0 -9
- package/dist/types/uuid.d.ts +0 -1
- package/dist/types/video.d.ts +0 -22
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// src/lib/loading-debounce.ts
|
|
2
|
-
/**
|
|
3
|
-
* Delay in milliseconds before showing the loading spinner
|
|
4
|
-
* This prevents flash-of-spinner for brief buffering moments
|
|
5
|
-
*/
|
|
6
|
-
const LOADING_SPINNER_DELAY_MS = 300;
|
|
7
|
-
/**
|
|
8
|
-
* Create initial loading debounce state
|
|
9
|
-
*/
|
|
10
|
-
function createLoadingDebounceState() {
|
|
11
|
-
return { timerId: null };
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Update loading state with debounce
|
|
15
|
-
*/
|
|
16
|
-
function updateLoadingState(options) {
|
|
17
|
-
const { state, shouldShow, onShow, onHide } = options;
|
|
18
|
-
if (state.timerId !== null) {
|
|
19
|
-
clearTimeout(state.timerId);
|
|
20
|
-
state.timerId = null;
|
|
21
|
-
}
|
|
22
|
-
if (shouldShow) state.timerId = setTimeout(() => {
|
|
23
|
-
state.timerId = null;
|
|
24
|
-
onShow();
|
|
25
|
-
}, 300);
|
|
26
|
-
else onHide();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Clean up loading debounce state (clear any pending timers)
|
|
30
|
-
*/
|
|
31
|
-
function cleanupLoadingDebounce(state) {
|
|
32
|
-
if (state.timerId !== null) {
|
|
33
|
-
clearTimeout(state.timerId);
|
|
34
|
-
state.timerId = null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { LOADING_SPINNER_DELAY_MS, cleanupLoadingDebounce, createLoadingDebounceState, updateLoadingState };
|
package/dist/lib/numbers.d.ts
DELETED
package/dist/lib/numbers.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// src/lib/numbers.ts
|
|
2
|
-
/**
|
|
3
|
-
* Clamp a value between min and max bounds
|
|
4
|
-
*/
|
|
5
|
-
function clamp(value, min, max) {
|
|
6
|
-
return Math.max(min, Math.min(max, value));
|
|
7
|
-
}
|
|
8
|
-
function formatNumber(number) {
|
|
9
|
-
if (number < 1e4) return number.toString();
|
|
10
|
-
const units = [
|
|
11
|
-
"",
|
|
12
|
-
"k",
|
|
13
|
-
"M",
|
|
14
|
-
"B"
|
|
15
|
-
];
|
|
16
|
-
const logBase1000 = Math.log10(number) / 3 | 0;
|
|
17
|
-
const scaledNumber = number / 1e3 ** logBase1000;
|
|
18
|
-
let strNumber = (Math.floor(scaledNumber * 10) / 10).toString();
|
|
19
|
-
if (strNumber.includes(".")) strNumber = strNumber.replace(/\.0$/, "");
|
|
20
|
-
return strNumber + units[logBase1000];
|
|
21
|
-
}
|
|
22
|
-
function formatNumberSm(number) {
|
|
23
|
-
const units = [
|
|
24
|
-
"",
|
|
25
|
-
"k",
|
|
26
|
-
"M",
|
|
27
|
-
"B"
|
|
28
|
-
];
|
|
29
|
-
const logBase1000 = Math.log10(number) / 3 | 0;
|
|
30
|
-
const scaledNumber = number / 1e3 ** logBase1000;
|
|
31
|
-
let strNumber = (Math.floor(scaledNumber * 10) / 10).toString();
|
|
32
|
-
if (strNumber.includes(".")) strNumber = strNumber.replace(/\.0$/, "");
|
|
33
|
-
return strNumber + units[logBase1000];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { clamp, formatNumber, formatNumberSm };
|
package/dist/lib/pip-utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for Picture-in-Picture logic
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Check if a video element is currently in Picture-in-Picture mode.
|
|
6
|
-
*
|
|
7
|
-
* Browsers disagree for a video inside shadow DOM: by the spec,
|
|
8
|
-
* `document.pictureInPictureElement` is retargeted to the shadow host and the
|
|
9
|
-
* owning ShadowRoot reports the video, but Chromium reports the video on the
|
|
10
|
-
* document and nothing on the ShadowRoot. Either match counts.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isVideoPictureInPicture(video: HTMLVideoElement | null): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Helper to toggle PIP mode safely
|
|
15
|
-
*/
|
|
16
|
-
export declare function togglePictureInPicture(video: HTMLVideoElement | null): Promise<void>;
|
package/dist/lib/pip-utils.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// src/lib/pip-utils.ts
|
|
2
|
-
/**
|
|
3
|
-
* Utility functions for Picture-in-Picture logic
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Check if a video element is currently in Picture-in-Picture mode.
|
|
7
|
-
*
|
|
8
|
-
* Browsers disagree for a video inside shadow DOM: by the spec,
|
|
9
|
-
* `document.pictureInPictureElement` is retargeted to the shadow host and the
|
|
10
|
-
* owning ShadowRoot reports the video, but Chromium reports the video on the
|
|
11
|
-
* document and nothing on the ShadowRoot. Either match counts.
|
|
12
|
-
*/
|
|
13
|
-
function isVideoPictureInPicture(video) {
|
|
14
|
-
if (!video) return false;
|
|
15
|
-
if (document.pictureInPictureElement === video) return true;
|
|
16
|
-
const root = video.getRootNode();
|
|
17
|
-
return root instanceof ShadowRoot && root.pictureInPictureElement === video;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Helper to toggle PIP mode safely
|
|
21
|
-
*/
|
|
22
|
-
async function togglePictureInPicture(video) {
|
|
23
|
-
if (!video) return;
|
|
24
|
-
try {
|
|
25
|
-
if (isVideoPictureInPicture(video)) await document.exitPictureInPicture();
|
|
26
|
-
else await video.requestPictureInPicture();
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.error("Error toggling PIP:", err);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { isVideoPictureInPicture, togglePictureInPicture };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UUID } from "../types/uuid.js";
|
|
2
|
-
import { VideoData } from "../types/video.js";
|
|
3
|
-
/**
|
|
4
|
-
* Calculate aspect ratio from video element dimensions
|
|
5
|
-
* @returns aspect ratio (width/height) or undefined if dimensions not available
|
|
6
|
-
*/
|
|
7
|
-
export declare function calculateAspectRatio(videoElement: HTMLVideoElement | null, videoData: VideoData | undefined): number | undefined;
|
|
8
|
-
export interface PlaybackHandlerCallbacks {
|
|
9
|
-
onSegmentStart: () => void;
|
|
10
|
-
onSegmentEnd: () => void;
|
|
11
|
-
onRestartSegment: (isPaused?: boolean) => void;
|
|
12
|
-
onShowSpinner: (show: boolean) => void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Handle video play event
|
|
16
|
-
*/
|
|
17
|
-
export declare function handleVideoPlay(playerId: UUID, callbacks: Pick<PlaybackHandlerCallbacks, "onSegmentStart">): void;
|
|
18
|
-
/**
|
|
19
|
-
* Handle video pause event
|
|
20
|
-
*/
|
|
21
|
-
export declare function handleVideoPause(playerId: UUID, callbacks: Pick<PlaybackHandlerCallbacks, "onSegmentEnd">): void;
|
|
22
|
-
/**
|
|
23
|
-
* Handle video rate change event
|
|
24
|
-
*/
|
|
25
|
-
export declare function handleVideoRateChange(playerId: UUID, videoElement: HTMLVideoElement | null, callbacks: Pick<PlaybackHandlerCallbacks, "onRestartSegment">): void;
|
|
26
|
-
/**
|
|
27
|
-
* Handle video error event
|
|
28
|
-
*/
|
|
29
|
-
export declare function handleVideoError(playerId: UUID, callbacks: Pick<PlaybackHandlerCallbacks, "onShowSpinner">): void;
|
|
30
|
-
/**
|
|
31
|
-
* Update player loading state in store
|
|
32
|
-
*/
|
|
33
|
-
export declare function updatePlayerLoadingState(playerId: UUID, isLoading: boolean): void;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { playerStateStore } from "../store/player-store.js";
|
|
2
|
-
|
|
3
|
-
// src/lib/playback-handlers.ts
|
|
4
|
-
/**
|
|
5
|
-
* Calculate aspect ratio from video element dimensions
|
|
6
|
-
* @returns aspect ratio (width/height) or undefined if dimensions not available
|
|
7
|
-
*/
|
|
8
|
-
function calculateAspectRatio(videoElement, videoData) {
|
|
9
|
-
if (!videoElement || !videoData) return void 0;
|
|
10
|
-
if (videoElement.videoWidth === 0 || videoElement.videoHeight === 0) return void 0;
|
|
11
|
-
return videoElement.videoWidth / videoElement.videoHeight;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Handle video play event
|
|
15
|
-
*/
|
|
16
|
-
function handleVideoPlay(playerId, callbacks) {
|
|
17
|
-
playerStateStore.setPaused(playerId, false);
|
|
18
|
-
playerStateStore.setEnded(playerId, false);
|
|
19
|
-
callbacks.onSegmentStart();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Handle video pause event
|
|
23
|
-
*/
|
|
24
|
-
function handleVideoPause(playerId, callbacks) {
|
|
25
|
-
playerStateStore.setPaused(playerId, true);
|
|
26
|
-
callbacks.onSegmentEnd();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Handle video rate change event
|
|
30
|
-
*/
|
|
31
|
-
function handleVideoRateChange(playerId, videoElement, callbacks) {
|
|
32
|
-
const playbackRate = videoElement?.playbackRate;
|
|
33
|
-
if (typeof playbackRate === "number") playerStateStore.setPlaybackRate(playerId, playbackRate);
|
|
34
|
-
callbacks.onRestartSegment();
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Handle video error event
|
|
38
|
-
*/
|
|
39
|
-
function handleVideoError(playerId, callbacks) {
|
|
40
|
-
playerStateStore.setPaused(playerId, true);
|
|
41
|
-
playerStateStore.setLoading(playerId, false);
|
|
42
|
-
callbacks.onShowSpinner(false);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Update player loading state in store
|
|
46
|
-
*/
|
|
47
|
-
function updatePlayerLoadingState(playerId, isLoading) {
|
|
48
|
-
playerStateStore.setLoading(playerId, isLoading);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { calculateAspectRatio, handleVideoError, handleVideoPause, handleVideoPlay, handleVideoRateChange, updatePlayerLoadingState };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fill percentage for the custom playback-speed slider. Piecewise on purpose:
|
|
3
|
-
* normal speed (1.0x) sits at the visual middle of the track, with min–1.0
|
|
4
|
-
* mapped to the lower half and 1.0–max to the upper half. Note the pointer
|
|
5
|
-
* mapping below is linear — the same asymmetry the React slider ships with.
|
|
6
|
-
*/
|
|
7
|
-
export declare function computePlaybackFillPercentage(value: number, min: number, max: number): number;
|
|
8
|
-
export interface PlaybackPointerOptions {
|
|
9
|
-
rect: {
|
|
10
|
-
left: number;
|
|
11
|
-
width: number;
|
|
12
|
-
};
|
|
13
|
-
clientX: number;
|
|
14
|
-
min: number;
|
|
15
|
-
max: number;
|
|
16
|
-
step: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Linear pointer-position → playback value: clamped to the track, snapped to
|
|
20
|
-
* the step grid, formatted to two decimals (the value React persists via
|
|
21
|
-
* settingsStore.setCustomPlayback).
|
|
22
|
-
*/
|
|
23
|
-
export declare function computePlaybackValueFromPointer({ rect, clientX, min, max, step }: PlaybackPointerOptions): number;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { clamp } from "./numbers.js";
|
|
2
|
-
|
|
3
|
-
// src/lib/playback-slider.ts
|
|
4
|
-
/**
|
|
5
|
-
* Fill percentage for the custom playback-speed slider. Piecewise on purpose:
|
|
6
|
-
* normal speed (1.0x) sits at the visual middle of the track, with min–1.0
|
|
7
|
-
* mapped to the lower half and 1.0–max to the upper half. Note the pointer
|
|
8
|
-
* mapping below is linear — the same asymmetry the React slider ships with.
|
|
9
|
-
*/
|
|
10
|
-
function computePlaybackFillPercentage(value, min, max) {
|
|
11
|
-
return value >= 1 ? 50 + (value - 1) / (max - 1) * 50 : (value - min) / (1 - min) * 50;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Linear pointer-position → playback value: clamped to the track, snapped to
|
|
15
|
-
* the step grid, formatted to two decimals (the value React persists via
|
|
16
|
-
* settingsStore.setCustomPlayback).
|
|
17
|
-
*/
|
|
18
|
-
function computePlaybackValueFromPointer({ rect, clientX, min, max, step }) {
|
|
19
|
-
const rawValue = min + clamp((clientX - rect.left) / rect.width, 0, 1) * (max - min);
|
|
20
|
-
const steppedValue = Math.round(rawValue / step) * step;
|
|
21
|
-
return Number(clamp(steppedValue, min, max).toFixed(2));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { computePlaybackFillPercentage, computePlaybackValueFromPointer };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const PLAYER_LANGUAGES: readonly ["en", "de", "es", "fr", "it", "pl", "ru", "tr", "uk"];
|
|
2
|
-
export type PlayerLanguage = (typeof PLAYER_LANGUAGES)[number];
|
|
3
|
-
/**
|
|
4
|
-
* Control-bar strings for the player UI. Values mirror the `controls.*` and
|
|
5
|
-
* `captions.toggle` keys of packages/react/src/locales/<lang>.json — one
|
|
6
|
-
* label per button regardless of state, keyboard hint included, same as the
|
|
7
|
-
* React tooltips.
|
|
8
|
-
*/
|
|
9
|
-
export interface PlayerControlLabels {
|
|
10
|
-
play: string;
|
|
11
|
-
pause: string;
|
|
12
|
-
replay: string;
|
|
13
|
-
mute: string;
|
|
14
|
-
unmute: string;
|
|
15
|
-
volume: string;
|
|
16
|
-
settings: string;
|
|
17
|
-
pip: string;
|
|
18
|
-
fullScreen: string;
|
|
19
|
-
captionsToggle: string;
|
|
20
|
-
}
|
|
21
|
-
/** Same semantics as the React resolveSupportedLanguage: lowercase exact match, fallback en. */
|
|
22
|
-
export declare function resolvePlayerLanguage(code: string | null | undefined): PlayerLanguage;
|
|
23
|
-
export declare function getPlayerControlLabels(code: string | null | undefined): PlayerControlLabels;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// src/lib/player-labels.ts
|
|
2
|
-
const PLAYER_LANGUAGES = [
|
|
3
|
-
"en",
|
|
4
|
-
"de",
|
|
5
|
-
"es",
|
|
6
|
-
"fr",
|
|
7
|
-
"it",
|
|
8
|
-
"pl",
|
|
9
|
-
"ru",
|
|
10
|
-
"tr",
|
|
11
|
-
"uk"
|
|
12
|
-
];
|
|
13
|
-
const LABELS = {
|
|
14
|
-
en: {
|
|
15
|
-
play: "Play (k)",
|
|
16
|
-
pause: "Pause (k)",
|
|
17
|
-
replay: "Replay",
|
|
18
|
-
mute: "Mute (m)",
|
|
19
|
-
unmute: "Unmute (m)",
|
|
20
|
-
volume: "Volume",
|
|
21
|
-
settings: "Settings",
|
|
22
|
-
pip: "Miniplayer (i)",
|
|
23
|
-
fullScreen: "Full screen (f)",
|
|
24
|
-
captionsToggle: "Subtitles/close captions (c)"
|
|
25
|
-
},
|
|
26
|
-
de: {
|
|
27
|
-
play: "Wiedergabe (k)",
|
|
28
|
-
pause: "Pause (k)",
|
|
29
|
-
replay: "Wiederholen",
|
|
30
|
-
mute: "Stummschalten (m)",
|
|
31
|
-
unmute: "Stummschaltung aufheben (m)",
|
|
32
|
-
volume: "Lautstärke",
|
|
33
|
-
settings: "Einstellungen",
|
|
34
|
-
pip: "Bild-im-Bild (i)",
|
|
35
|
-
fullScreen: "Vollbild (f)",
|
|
36
|
-
captionsToggle: "Untertitel/CC (c)"
|
|
37
|
-
},
|
|
38
|
-
es: {
|
|
39
|
-
play: "Reproducir (k)",
|
|
40
|
-
pause: "Pausar (k)",
|
|
41
|
-
replay: "Repetir",
|
|
42
|
-
mute: "Silenciar (m)",
|
|
43
|
-
unmute: "Reactivar sonido (m)",
|
|
44
|
-
volume: "Volumen",
|
|
45
|
-
settings: "Configuración",
|
|
46
|
-
pip: "Minirreproductor (i)",
|
|
47
|
-
fullScreen: "Pantalla completa (f)",
|
|
48
|
-
captionsToggle: "Subtítulos (c)"
|
|
49
|
-
},
|
|
50
|
-
fr: {
|
|
51
|
-
play: "Lire (k)",
|
|
52
|
-
pause: "Pause (k)",
|
|
53
|
-
replay: "Rejouer",
|
|
54
|
-
mute: "Muet (m)",
|
|
55
|
-
unmute: "Réactiver le son (m)",
|
|
56
|
-
volume: "Volume",
|
|
57
|
-
settings: "Paramètres",
|
|
58
|
-
pip: "Mini-lecteur (i)",
|
|
59
|
-
fullScreen: "Plein écran (f)",
|
|
60
|
-
captionsToggle: "Sous-titres/CC (c)"
|
|
61
|
-
},
|
|
62
|
-
it: {
|
|
63
|
-
play: "Riproduci (k)",
|
|
64
|
-
pause: "Pausa (k)",
|
|
65
|
-
replay: "Rivedi",
|
|
66
|
-
mute: "Disattiva audio (m)",
|
|
67
|
-
unmute: "Riattiva audio (m)",
|
|
68
|
-
volume: "Volume",
|
|
69
|
-
settings: "Impostazioni",
|
|
70
|
-
pip: "Miniplayer (i)",
|
|
71
|
-
fullScreen: "Schermo intero (f)",
|
|
72
|
-
captionsToggle: "Sottotitoli (c)"
|
|
73
|
-
},
|
|
74
|
-
pl: {
|
|
75
|
-
play: "Odtwórz (k)",
|
|
76
|
-
pause: "Pauza (k)",
|
|
77
|
-
replay: "Odtwórz ponownie",
|
|
78
|
-
mute: "Wycisz (m)",
|
|
79
|
-
unmute: "Wyłącz wyciszenie (m)",
|
|
80
|
-
volume: "Głośność",
|
|
81
|
-
settings: "Ustawienia",
|
|
82
|
-
pip: "Mini-odtwarzacz (i)",
|
|
83
|
-
fullScreen: "Pełny ekran (f)",
|
|
84
|
-
captionsToggle: "Napisy (c)"
|
|
85
|
-
},
|
|
86
|
-
ru: {
|
|
87
|
-
play: "Воспроизвести (k)",
|
|
88
|
-
pause: "Пауза (k)",
|
|
89
|
-
replay: "Воспроизвести снова",
|
|
90
|
-
mute: "Выключить звук (m)",
|
|
91
|
-
unmute: "Включить звук (m)",
|
|
92
|
-
volume: "Громкость",
|
|
93
|
-
settings: "Настройки",
|
|
94
|
-
pip: "Мини-плеер (i)",
|
|
95
|
-
fullScreen: "Во весь экран (f)",
|
|
96
|
-
captionsToggle: "Субтитры (c)"
|
|
97
|
-
},
|
|
98
|
-
tr: {
|
|
99
|
-
play: "Oynat (k)",
|
|
100
|
-
pause: "Duraklat (k)",
|
|
101
|
-
replay: "Tekrar oyna",
|
|
102
|
-
mute: "Sessize al (m)",
|
|
103
|
-
unmute: "Sesi aç (m)",
|
|
104
|
-
volume: "Ses düzeyi",
|
|
105
|
-
settings: "Ayarlar",
|
|
106
|
-
pip: "Mini oynatıcı (i)",
|
|
107
|
-
fullScreen: "Tam ekran (f)",
|
|
108
|
-
captionsToggle: "Altyazılar (c)"
|
|
109
|
-
},
|
|
110
|
-
uk: {
|
|
111
|
-
play: "Відтворити (k)",
|
|
112
|
-
pause: "Пауза (k)",
|
|
113
|
-
replay: "Повторити",
|
|
114
|
-
mute: "Вимкнути звук (m)",
|
|
115
|
-
unmute: "Увімкнути звук (m)",
|
|
116
|
-
volume: "Гучність",
|
|
117
|
-
settings: "Налаштування",
|
|
118
|
-
pip: "Міні-плеєр (i)",
|
|
119
|
-
fullScreen: "На весь екран (f)",
|
|
120
|
-
captionsToggle: "Субтитри (c)"
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
/** Same semantics as the React resolveSupportedLanguage: lowercase exact match, fallback en. */
|
|
124
|
-
function resolvePlayerLanguage(code) {
|
|
125
|
-
const normalized = (code ?? "").toLowerCase();
|
|
126
|
-
return PLAYER_LANGUAGES.find((lang) => lang === normalized) ?? "en";
|
|
127
|
-
}
|
|
128
|
-
function getPlayerControlLabels(code) {
|
|
129
|
-
return LABELS[resolvePlayerLanguage(code)];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { PLAYER_LANGUAGES, getPlayerControlLabels, resolvePlayerLanguage };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { FontFamilyKey } from "../store/settings/constants.js";
|
|
2
|
-
/**
|
|
3
|
-
* Settings-menu strings, mirroring the corresponding keys of
|
|
4
|
-
* packages/react/src/locales/<lang>.json verbatim (quality.*, audio.*,
|
|
5
|
-
* playback.*, captions.* and common.*). Edge-style options are keyed by the
|
|
6
|
-
* EDGE_STYLES runtime values and font families by FontFamilyKey, so menus can
|
|
7
|
-
* look labels up directly from the constants they render.
|
|
8
|
-
*
|
|
9
|
-
* Import this module from the lazy settings chunk only — it must not be
|
|
10
|
-
* pulled into the initial player bundle.
|
|
11
|
-
*/
|
|
12
|
-
export interface PlayerMenuLabels {
|
|
13
|
-
quality: {
|
|
14
|
-
title: string;
|
|
15
|
-
auto: string;
|
|
16
|
-
};
|
|
17
|
-
audio: {
|
|
18
|
-
title: string;
|
|
19
|
-
noTracks: string;
|
|
20
|
-
};
|
|
21
|
-
playback: {
|
|
22
|
-
speed: string;
|
|
23
|
-
custom: string;
|
|
24
|
-
normal: string;
|
|
25
|
-
};
|
|
26
|
-
captions: {
|
|
27
|
-
title: string;
|
|
28
|
-
off: string;
|
|
29
|
-
style: string;
|
|
30
|
-
font: string;
|
|
31
|
-
background: string;
|
|
32
|
-
window: string;
|
|
33
|
-
resetAll: string;
|
|
34
|
-
edgeStyle: {
|
|
35
|
-
title: string;
|
|
36
|
-
options: Record<string, string>;
|
|
37
|
-
};
|
|
38
|
-
fontFamilies: Record<FontFamilyKey, string>;
|
|
39
|
-
};
|
|
40
|
-
stats: {
|
|
41
|
-
title: string;
|
|
42
|
-
copyDebug: string;
|
|
43
|
-
videoId: string;
|
|
44
|
-
playerId: string;
|
|
45
|
-
viewport: string;
|
|
46
|
-
dropped: string;
|
|
47
|
-
resolution: string;
|
|
48
|
-
volume: string;
|
|
49
|
-
codecs: string;
|
|
50
|
-
color: string;
|
|
51
|
-
connectionSpeed: string;
|
|
52
|
-
bufferHealth: string;
|
|
53
|
-
};
|
|
54
|
-
shortcuts: {
|
|
55
|
-
title: string;
|
|
56
|
-
playPause: string;
|
|
57
|
-
seek10s: string;
|
|
58
|
-
seek5s: string;
|
|
59
|
-
pip: string;
|
|
60
|
-
fullscreen: string;
|
|
61
|
-
mute: string;
|
|
62
|
-
volume: string;
|
|
63
|
-
};
|
|
64
|
-
colors: Record<string, string>;
|
|
65
|
-
common: {
|
|
66
|
-
back: string;
|
|
67
|
-
family: string;
|
|
68
|
-
more: string;
|
|
69
|
-
less: string;
|
|
70
|
-
settings: string;
|
|
71
|
-
size: string;
|
|
72
|
-
opacity: string;
|
|
73
|
-
color: string;
|
|
74
|
-
reset: string;
|
|
75
|
-
custom: string;
|
|
76
|
-
options: string;
|
|
77
|
-
off: string;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
export declare function getPlayerMenuLabels(code: string | null | undefined): PlayerMenuLabels;
|