@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.
Files changed (172) hide show
  1. package/README.md +74 -84
  2. package/dist/chunks/B-QvSqjj.js +1 -0
  3. package/dist/chunks/B2DDE32u.js +1 -0
  4. package/dist/chunks/DMkwQjgA.js +1 -0
  5. package/dist/index.d.ts +1906 -82
  6. package/dist/index.js +6 -73
  7. package/package.json +13 -6
  8. package/dist/api/analytics.d.ts +0 -16
  9. package/dist/api/analytics.js +0 -227
  10. package/dist/api/feed.js +0 -52
  11. package/dist/api/heatmap.d.ts +0 -6
  12. package/dist/api/heatmap.js +0 -28
  13. package/dist/api/hot-segments.d.ts +0 -7
  14. package/dist/api/hot-segments.js +0 -20
  15. package/dist/api/image.js +0 -11
  16. package/dist/api/rixl-client.d.ts +0 -3
  17. package/dist/api/rixl-client.js +0 -14
  18. package/dist/api/upload.d.ts +0 -76
  19. package/dist/api/upload.js +0 -150
  20. package/dist/api/video.js +0 -11
  21. package/dist/lib/analytics-builders.d.ts +0 -59
  22. package/dist/lib/analytics-builders.js +0 -88
  23. package/dist/lib/analytics-initialize.d.ts +0 -1
  24. package/dist/lib/analytics-initialize.js +0 -59
  25. package/dist/lib/analytics-utils.d.ts +0 -43
  26. package/dist/lib/analytics-utils.js +0 -85
  27. package/dist/lib/analytics-wire.js +0 -153
  28. package/dist/lib/buffer-progress.d.ts +0 -20
  29. package/dist/lib/buffer-progress.js +0 -37
  30. package/dist/lib/caption-styles.d.ts +0 -20
  31. package/dist/lib/caption-styles.js +0 -56
  32. package/dist/lib/caption-utils.d.ts +0 -80
  33. package/dist/lib/caption-utils.js +0 -111
  34. package/dist/lib/chapter-utils.d.ts +0 -102
  35. package/dist/lib/chapter-utils.js +0 -147
  36. package/dist/lib/click-disambiguation.d.ts +0 -44
  37. package/dist/lib/click-disambiguation.js +0 -80
  38. package/dist/lib/click-outside.d.ts +0 -68
  39. package/dist/lib/click-outside.js +0 -64
  40. package/dist/lib/colors.d.ts +0 -6
  41. package/dist/lib/colors.js +0 -16
  42. package/dist/lib/content-analytics.d.ts +0 -27
  43. package/dist/lib/content-analytics.js +0 -38
  44. package/dist/lib/environment-effects.d.ts +0 -89
  45. package/dist/lib/environment-effects.js +0 -139
  46. package/dist/lib/feed-autoscroll.d.ts +0 -10
  47. package/dist/lib/feed-autoscroll.js +0 -13
  48. package/dist/lib/feed-container-height.d.ts +0 -7
  49. package/dist/lib/feed-container-height.js +0 -11
  50. package/dist/lib/feed-description-overflow.d.ts +0 -1
  51. package/dist/lib/feed-description-overflow.js +0 -9
  52. package/dist/lib/feed-dwell.d.ts +0 -2
  53. package/dist/lib/feed-dwell.js +0 -8
  54. package/dist/lib/feed-loop.d.ts +0 -10
  55. package/dist/lib/feed-loop.js +0 -21
  56. package/dist/lib/feed-scroll.d.ts +0 -11
  57. package/dist/lib/feed-scroll.js +0 -19
  58. package/dist/lib/feed-transforms.d.ts +0 -5
  59. package/dist/lib/feed-transforms.js +0 -30
  60. package/dist/lib/filter-undefined.js +0 -11
  61. package/dist/lib/fullscreen-utils.d.ts +0 -1
  62. package/dist/lib/fullscreen-utils.js +0 -7
  63. package/dist/lib/hls-buffer-flush.js +0 -46
  64. package/dist/lib/hls-error-recovery.d.ts +0 -35
  65. package/dist/lib/hls-error-recovery.js +0 -75
  66. package/dist/lib/hls-event-handlers.js +0 -61
  67. package/dist/lib/hls-loader.js +0 -23
  68. package/dist/lib/hls-setup.d.ts +0 -72
  69. package/dist/lib/hls-setup.js +0 -144
  70. package/dist/lib/hls-utils.d.ts +0 -31
  71. package/dist/lib/hls-utils.js +0 -34
  72. package/dist/lib/image-render.d.ts +0 -29
  73. package/dist/lib/image-render.js +0 -63
  74. package/dist/lib/keyboard-config.d.ts +0 -66
  75. package/dist/lib/keyboard-config.js +0 -127
  76. package/dist/lib/keyboard-utils.d.ts +0 -4
  77. package/dist/lib/keyboard-utils.js +0 -11
  78. package/dist/lib/lifecycle-effects.d.ts +0 -67
  79. package/dist/lib/lifecycle-effects.js +0 -78
  80. package/dist/lib/loading-debounce.d.ts +0 -26
  81. package/dist/lib/loading-debounce.js +0 -38
  82. package/dist/lib/numbers.d.ts +0 -6
  83. package/dist/lib/numbers.js +0 -36
  84. package/dist/lib/pip-utils.d.ts +0 -16
  85. package/dist/lib/pip-utils.js +0 -32
  86. package/dist/lib/playback-handlers.d.ts +0 -33
  87. package/dist/lib/playback-handlers.js +0 -51
  88. package/dist/lib/playback-slider.d.ts +0 -23
  89. package/dist/lib/playback-slider.js +0 -24
  90. package/dist/lib/player-labels.d.ts +0 -23
  91. package/dist/lib/player-labels.js +0 -132
  92. package/dist/lib/player-menu-labels.d.ts +0 -80
  93. package/dist/lib/player-menu-labels.js +0 -829
  94. package/dist/lib/player-ui-actions.d.ts +0 -10
  95. package/dist/lib/player-ui-actions.js +0 -58
  96. package/dist/lib/progress-fraction.d.ts +0 -11
  97. package/dist/lib/progress-fraction.js +0 -20
  98. package/dist/lib/progress-persist.d.ts +0 -28
  99. package/dist/lib/progress-persist.js +0 -54
  100. package/dist/lib/segment-analytics.d.ts +0 -20
  101. package/dist/lib/segment-analytics.js +0 -29
  102. package/dist/lib/subtitle-logic.d.ts +0 -31
  103. package/dist/lib/subtitle-logic.js +0 -75
  104. package/dist/lib/subtitle-utils.d.ts +0 -16
  105. package/dist/lib/subtitle-utils.js +0 -37
  106. package/dist/lib/time.d.ts +0 -1
  107. package/dist/lib/time.js +0 -17
  108. package/dist/lib/track-persistence.d.ts +0 -4
  109. package/dist/lib/track-persistence.js +0 -35
  110. package/dist/lib/video-preload-config.d.ts +0 -34
  111. package/dist/lib/video-preload-config.js +0 -41
  112. package/dist/lib/video-spinner.d.ts +0 -25
  113. package/dist/lib/video-spinner.js +0 -35
  114. package/dist/lib/video-stats.d.ts +0 -28
  115. package/dist/lib/video-stats.js +0 -44
  116. package/dist/lib/volume-utils.d.ts +0 -59
  117. package/dist/lib/volume-utils.js +0 -55
  118. package/dist/progressbar.d.ts +0 -10
  119. package/dist/progressbar.js +0 -125
  120. package/dist/store/analytics-context-store.d.ts +0 -4
  121. package/dist/store/analytics-context-store.js +0 -13
  122. package/dist/store/analytics-device-store.d.ts +0 -8
  123. package/dist/store/analytics-device-store.js +0 -44
  124. package/dist/store/analytics-session-store.d.ts +0 -8
  125. package/dist/store/analytics-session-store.js +0 -40
  126. package/dist/store/analytics-store.d.ts +0 -30
  127. package/dist/store/analytics-store.js +0 -88
  128. package/dist/store/controls-store.d.ts +0 -16
  129. package/dist/store/controls-store.js +0 -53
  130. package/dist/store/feed-cache-store.d.ts +0 -24
  131. package/dist/store/feed-cache-store.js +0 -165
  132. package/dist/store/feed-interaction-store.d.ts +0 -17
  133. package/dist/store/feed-interaction-store.js +0 -32
  134. package/dist/store/feed-store.d.ts +0 -16
  135. package/dist/store/feed-store.js +0 -38
  136. package/dist/store/generic-store.js +0 -24
  137. package/dist/store/image-store.d.ts +0 -2
  138. package/dist/store/image-store.js +0 -8
  139. package/dist/store/player-container-element-store.d.ts +0 -10
  140. package/dist/store/player-container-element-store.js +0 -38
  141. package/dist/store/player-global-actions.js +0 -53
  142. package/dist/store/player-media-element-store.d.ts +0 -10
  143. package/dist/store/player-media-element-store.js +0 -38
  144. package/dist/store/player-store-actions.js +0 -197
  145. package/dist/store/player-store.d.ts +0 -94
  146. package/dist/store/player-store.js +0 -127
  147. package/dist/store/player-track-actions.js +0 -44
  148. package/dist/store/postStore.d.ts +0 -20
  149. package/dist/store/postStore.js +0 -112
  150. package/dist/store/settings/constants.d.ts +0 -15
  151. package/dist/store/settings/constants.js +0 -47
  152. package/dist/store/settings/defaults.d.ts +0 -2
  153. package/dist/store/settings/defaults.js +0 -24
  154. package/dist/store/settings/storage.d.ts +0 -3
  155. package/dist/store/settings/storage.js +0 -28
  156. package/dist/store/settings/store.d.ts +0 -32
  157. package/dist/store/settings/store.js +0 -59
  158. package/dist/store/settings/types.d.ts +0 -27
  159. package/dist/store/settings/validation.d.ts +0 -7
  160. package/dist/store/settings/validation.js +0 -55
  161. package/dist/store/settings-menu-store.d.ts +0 -19
  162. package/dist/store/settings-menu-store.js +0 -30
  163. package/dist/store/video-store.d.ts +0 -2
  164. package/dist/store/video-store.js +0 -8
  165. package/dist/types/analytics.d.ts +0 -113
  166. package/dist/types/feed.d.ts +0 -21
  167. package/dist/types/file.d.ts +0 -12
  168. package/dist/types/heatmap.d.ts +0 -5
  169. package/dist/types/hot-segments.d.ts +0 -9
  170. package/dist/types/image.d.ts +0 -9
  171. package/dist/types/uuid.d.ts +0 -1
  172. package/dist/types/video.d.ts +0 -22
@@ -1,55 +0,0 @@
1
- import { COLORS, EDGE_STYLES, FONT_FAMILIES, FONT_SIZES, LANG_TYPES } from "./constants.js";
2
- import { defaultSettings } from "./defaults.js";
3
- import * as v from "valibot";
4
-
5
- // src/store/settings/validation.ts
6
- const opacitySchema = v.pipe(v.number(), v.minValue(0), v.maxValue(100));
7
- const volumeSchema = v.pipe(v.number(), v.minValue(0), v.maxValue(1));
8
- const playbackSpeedSchema = v.pipe(v.number(), v.minValue(.25), v.maxValue(3));
9
- const colorOptions = Object.values(COLORS);
10
- const fontFamilyOptions = Object.keys(FONT_FAMILIES);
11
- const fontSizeOptions = FONT_SIZES;
12
- const edgeStyleOptions = EDGE_STYLES;
13
- const captionLangOptions = LANG_TYPES;
14
- const colorSchema = v.picklist(colorOptions);
15
- const fontFamilySchema = v.picklist(fontFamilyOptions);
16
- const fontSizeSchema = v.picklist(fontSizeOptions);
17
- const edgeStyleSchema = v.picklist(edgeStyleOptions);
18
- const captionPositionSchema = v.object({
19
- x: v.number(),
20
- y: v.number()
21
- });
22
- const captionLangSchema = v.picklist(captionLangOptions);
23
- const settingsSchema = v.object({
24
- volume: v.fallback(volumeSchema, defaultSettings.volume),
25
- playbackSpeed: v.fallback(playbackSpeedSchema, defaultSettings.playbackSpeed),
26
- customPlayback: v.fallback(playbackSpeedSchema, defaultSettings.customPlayback),
27
- allowCaptions: v.fallback(v.boolean(), defaultSettings.allowCaptions),
28
- captionPosition: v.fallback(captionPositionSchema, defaultSettings.captionPosition),
29
- captionLang: v.fallback(captionLangSchema, defaultSettings.captionLang),
30
- captionFontFamily: v.fallback(fontFamilySchema, defaultSettings.captionFontFamily),
31
- captionFontSize: v.fallback(fontSizeSchema, defaultSettings.captionFontSize),
32
- captionFontColor: v.fallback(colorSchema, defaultSettings.captionFontColor),
33
- captionFontOpacity: v.fallback(opacitySchema, defaultSettings.captionFontOpacity),
34
- captionBGColor: v.fallback(colorSchema, defaultSettings.captionBGColor),
35
- captionBGOpacity: v.fallback(opacitySchema, defaultSettings.captionBGOpacity),
36
- captionWindowColor: v.fallback(colorSchema, defaultSettings.captionWindowColor),
37
- captionWindowOpacity: v.fallback(opacitySchema, defaultSettings.captionWindowOpacity),
38
- captionCharacterEdgeStyle: v.fallback(edgeStyleSchema, defaultSettings.captionCharacterEdgeStyle),
39
- selectedLanguageCode: v.optional(v.string()),
40
- globalMutedPreference: v.fallback(v.boolean(), defaultSettings.globalMutedPreference),
41
- preferredQuality: v.optional(v.number()),
42
- preferredAudioLanguage: v.optional(v.string()),
43
- preferredSubtitleLanguage: v.optional(v.string())
44
- });
45
- /**
46
- * Validate and parse settings, returning defaults for invalid values
47
- * @param parsed - Raw settings object (e.g., from localStorage)
48
- * @returns Validated settings with defaults applied for invalid values
49
- */
50
- const validateSettings = (parsed) => {
51
- if (parsed === null || parsed === void 0) return { ...defaultSettings };
52
- return v.parse(settingsSchema, parsed);
53
- };
54
-
55
- export { validateSettings };
@@ -1,19 +0,0 @@
1
- import { ReadableAtom, WritableAtom } from "nanostores";
2
- /**
3
- * Settings-menu keys follow a hierarchical naming convention:
4
- * - Root menus: simple names (main, quality, audio, captions, playback)
5
- * - Nested menus: parent-child pattern (captions.style, captions.font, etc.)
6
- */
7
- export type MenuKey = "main" | "quality" | "audio" | "captions" | "playback" | "captions.style" | "captions.font" | "captions.background" | "captions.window" | "captions.font-family" | "captions.edge-style";
8
- /** Stack of visited menus for navigation history */
9
- export declare const menuStack: WritableAtom<MenuKey[]>;
10
- /** Direction of the last navigation (for animation) */
11
- export declare const navigationDirection: WritableAtom<"forward" | "back">;
12
- /** Current active menu is the top of the stack */
13
- export declare const activeMenu: ReadableAtom<MenuKey>;
14
- /** Navigate to a new menu (pushes to stack) */
15
- export declare const pushMenu: (menuId: MenuKey) => void;
16
- /** Go back to previous menu (pops from stack) */
17
- export declare const popMenu: () => void;
18
- /** Reset to main menu */
19
- export declare const resetMenu: () => void;
@@ -1,30 +0,0 @@
1
- import { atom, computed } from "nanostores";
2
-
3
- // src/store/settings-menu-store.ts
4
- /** Stack of visited menus for navigation history */
5
- const menuStack = atom(["main"]);
6
- /** Direction of the last navigation (for animation) */
7
- const navigationDirection = atom("forward");
8
- /** Current active menu is the top of the stack */
9
- const activeMenu = computed(menuStack, (stack) => stack[stack.length - 1]);
10
- /** Navigate to a new menu (pushes to stack) */
11
- const pushMenu = (menuId) => {
12
- const currentStack = menuStack.get();
13
- if (currentStack[currentStack.length - 1] === menuId) return;
14
- navigationDirection.set("forward");
15
- menuStack.set([...currentStack, menuId]);
16
- };
17
- /** Go back to previous menu (pops from stack) */
18
- const popMenu = () => {
19
- const currentStack = menuStack.get();
20
- if (currentStack.length <= 1) return;
21
- navigationDirection.set("back");
22
- menuStack.set(currentStack.slice(0, -1));
23
- };
24
- /** Reset to main menu */
25
- const resetMenu = () => {
26
- navigationDirection.set("back");
27
- menuStack.set(["main"]);
28
- };
29
-
30
- export { activeMenu, menuStack, navigationDirection, popMenu, pushMenu, resetMenu };
@@ -1,2 +0,0 @@
1
- import { VideoData } from "../types/video.js";
2
- export declare const getVideo: (videoId: string) => Promise<VideoData>;
@@ -1,8 +0,0 @@
1
- import { fetchVideo } from "../api/video.js";
2
- import { createStore } from "./generic-store.js";
3
-
4
- // src/store/video-store.ts
5
- const videoStore = createStore();
6
- const getVideo = (videoId) => videoStore.get(videoId, fetchVideo);
7
-
8
- export { getVideo };
@@ -1,113 +0,0 @@
1
- export type ContentType = "video" | "image";
2
- export type ViewType = "start" | "watch" | "end";
3
- export type Page = "feed" | "standalone" | "profile";
4
- export interface Segment {
5
- start_ms: number;
6
- end_ms: number;
7
- speed: number;
8
- }
9
- export interface ContentViewEvent {
10
- _type: "content_views";
11
- timestamp?: number;
12
- content_id: string;
13
- content_type: ContentType;
14
- view_type: ViewType;
15
- watch_duration_ms: number;
16
- page: Page;
17
- feed_id?: string;
18
- post_id?: string;
19
- video_position_ms?: number;
20
- video_total_duration_ms?: number;
21
- segments?: Segment[];
22
- device_id?: string;
23
- country?: string;
24
- }
25
- export interface EngagementEvent {
26
- _type: "engagement";
27
- timestamp?: number;
28
- engagement_type: string;
29
- resource_type?: string;
30
- resource_id?: string;
31
- page?: string;
32
- comment_text?: string;
33
- share_platform?: string;
34
- country?: string;
35
- device_type?: string;
36
- session_id?: string;
37
- }
38
- export interface InteractionEvent {
39
- _type: "interaction";
40
- timestamp?: number;
41
- interaction_type: string;
42
- element_type?: string;
43
- element_id?: string;
44
- session_id?: string;
45
- page?: string;
46
- page_url?: string;
47
- scroll_depth?: number;
48
- search_query?: string;
49
- click_x?: number;
50
- click_y?: number;
51
- device_type?: string;
52
- browser?: string;
53
- resource_id?: string;
54
- resource_type?: string;
55
- feed_id?: string;
56
- post_id?: string;
57
- content_id?: string;
58
- }
59
- export interface ErrorEvent {
60
- _type: "error";
61
- timestamp?: number;
62
- error_type: string;
63
- error_code?: string;
64
- error_message?: string;
65
- stack_trace?: string;
66
- resource_type?: string;
67
- resource_id?: string;
68
- endpoint?: string;
69
- session_id?: string;
70
- device_type?: string;
71
- browser?: string;
72
- os?: string;
73
- }
74
- export interface SessionStartEvent {
75
- _type: "session_start";
76
- timestamp?: number;
77
- utm_source?: string;
78
- utm_campaign?: string;
79
- browser?: string;
80
- language?: string;
81
- screen_resolution?: string;
82
- platform?: string;
83
- tg_platform?: string;
84
- tg_version?: string;
85
- timezone?: string;
86
- timezone_offset?: number;
87
- color_depth?: number;
88
- touch_support?: boolean;
89
- country?: string;
90
- user_id?: string;
91
- }
92
- export interface AnalyticsContext {
93
- user_id?: string;
94
- country?: string;
95
- city?: string;
96
- region?: string;
97
- device?: string;
98
- os?: string;
99
- os_version?: string;
100
- language?: string;
101
- browser?: string;
102
- screen_resolution?: string;
103
- platform?: string;
104
- tg_platform?: string;
105
- tg_version?: string;
106
- timezone?: string;
107
- timezone_offset?: number;
108
- color_depth?: number;
109
- touch_support?: boolean;
110
- utm_source?: string;
111
- utm_campaign?: string;
112
- }
113
- export type AnalyticsEvent = ContentViewEvent | EngagementEvent | InteractionEvent | ErrorEvent | SessionStartEvent;
@@ -1,21 +0,0 @@
1
- import { ImageData } from "./image.js";
2
- import { VideoData } from "./video.js";
3
- export interface FeedPost {
4
- id: string;
5
- feedId: string;
6
- creatorId: string;
7
- type: "image" | "video";
8
- description: string;
9
- createdAt: string;
10
- image?: ImageData;
11
- video?: VideoData;
12
- projectId?: string;
13
- planType?: string;
14
- updatedAt?: string;
15
- }
16
- export interface FeedPostsResponse {
17
- posts: FeedPost[];
18
- total: number;
19
- offset: number;
20
- limit: number;
21
- }
@@ -1,12 +0,0 @@
1
- export type FileStatus = "uploading" | "uploaded" | "processing" | "ready" | "error";
2
- export interface FileData {
3
- id: string;
4
- project_id: string;
5
- format: string;
6
- url: string;
7
- name: string;
8
- size: number;
9
- status: FileStatus;
10
- created_at: Date;
11
- updated_at: Date;
12
- }
@@ -1,5 +0,0 @@
1
- export interface VideoHeatmap {
2
- video_id: string;
3
- total_duration_ms: number;
4
- data: number[];
5
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Hot segment data for a video
3
- * Represents a segment with higher-than-average viewership
4
- */
5
- export interface HotSegment {
6
- start_second: number;
7
- end_second: number;
8
- multiplier: number;
9
- }
@@ -1,9 +0,0 @@
1
- import { FileData } from "./file.js";
2
- export interface ImageData {
3
- id: string;
4
- thumbhash: string;
5
- width: number;
6
- height: number;
7
- attached_to_video: boolean;
8
- file: FileData;
9
- }
@@ -1 +0,0 @@
1
- export type UUID = `${string}-${string}-${string}-${string}-${string}`;
@@ -1,22 +0,0 @@
1
- import { FileData } from "./file.js";
2
- import { ImageData } from "./image.js";
3
- export interface Chapter {
4
- title: string;
5
- start_time_sec: number;
6
- end_time_sec: number;
7
- duration_label: string;
8
- }
9
- export interface VideoData {
10
- id: string;
11
- file: FileData;
12
- poster: ImageData;
13
- duration: number;
14
- width: number;
15
- height: number;
16
- codec: string;
17
- bitrate: number;
18
- framerate: string;
19
- hdr: boolean;
20
- chapters?: Chapter[];
21
- plan_type?: "free" | "pro" | "pay-as-you-go" | "custom";
22
- }