@rixl/media-core 1.0.2 → 1.1.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.
Files changed (173) 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/BZFoe94X.js +1 -0
  5. package/dist/chunks/DMkwQjgA.js +1 -0
  6. package/dist/index.d.ts +2005 -82
  7. package/dist/index.js +6 -73
  8. package/package.json +13 -6
  9. package/dist/api/analytics.d.ts +0 -16
  10. package/dist/api/analytics.js +0 -227
  11. package/dist/api/feed.js +0 -52
  12. package/dist/api/heatmap.d.ts +0 -6
  13. package/dist/api/heatmap.js +0 -28
  14. package/dist/api/hot-segments.d.ts +0 -7
  15. package/dist/api/hot-segments.js +0 -20
  16. package/dist/api/image.js +0 -11
  17. package/dist/api/rixl-client.d.ts +0 -3
  18. package/dist/api/rixl-client.js +0 -14
  19. package/dist/api/upload.d.ts +0 -76
  20. package/dist/api/upload.js +0 -150
  21. package/dist/api/video.js +0 -11
  22. package/dist/lib/analytics-builders.d.ts +0 -59
  23. package/dist/lib/analytics-builders.js +0 -88
  24. package/dist/lib/analytics-initialize.d.ts +0 -1
  25. package/dist/lib/analytics-initialize.js +0 -59
  26. package/dist/lib/analytics-utils.d.ts +0 -43
  27. package/dist/lib/analytics-utils.js +0 -85
  28. package/dist/lib/analytics-wire.js +0 -153
  29. package/dist/lib/buffer-progress.d.ts +0 -20
  30. package/dist/lib/buffer-progress.js +0 -37
  31. package/dist/lib/caption-styles.d.ts +0 -20
  32. package/dist/lib/caption-styles.js +0 -56
  33. package/dist/lib/caption-utils.d.ts +0 -80
  34. package/dist/lib/caption-utils.js +0 -111
  35. package/dist/lib/chapter-utils.d.ts +0 -102
  36. package/dist/lib/chapter-utils.js +0 -147
  37. package/dist/lib/click-disambiguation.d.ts +0 -44
  38. package/dist/lib/click-disambiguation.js +0 -80
  39. package/dist/lib/click-outside.d.ts +0 -68
  40. package/dist/lib/click-outside.js +0 -64
  41. package/dist/lib/colors.d.ts +0 -6
  42. package/dist/lib/colors.js +0 -16
  43. package/dist/lib/content-analytics.d.ts +0 -27
  44. package/dist/lib/content-analytics.js +0 -38
  45. package/dist/lib/environment-effects.d.ts +0 -89
  46. package/dist/lib/environment-effects.js +0 -139
  47. package/dist/lib/feed-autoscroll.d.ts +0 -10
  48. package/dist/lib/feed-autoscroll.js +0 -13
  49. package/dist/lib/feed-container-height.d.ts +0 -7
  50. package/dist/lib/feed-container-height.js +0 -11
  51. package/dist/lib/feed-description-overflow.d.ts +0 -1
  52. package/dist/lib/feed-description-overflow.js +0 -9
  53. package/dist/lib/feed-dwell.d.ts +0 -2
  54. package/dist/lib/feed-dwell.js +0 -8
  55. package/dist/lib/feed-loop.d.ts +0 -10
  56. package/dist/lib/feed-loop.js +0 -21
  57. package/dist/lib/feed-scroll.d.ts +0 -11
  58. package/dist/lib/feed-scroll.js +0 -19
  59. package/dist/lib/feed-transforms.d.ts +0 -5
  60. package/dist/lib/feed-transforms.js +0 -30
  61. package/dist/lib/filter-undefined.js +0 -11
  62. package/dist/lib/fullscreen-utils.d.ts +0 -1
  63. package/dist/lib/fullscreen-utils.js +0 -7
  64. package/dist/lib/hls-buffer-flush.js +0 -46
  65. package/dist/lib/hls-error-recovery.d.ts +0 -35
  66. package/dist/lib/hls-error-recovery.js +0 -75
  67. package/dist/lib/hls-event-handlers.js +0 -61
  68. package/dist/lib/hls-loader.js +0 -23
  69. package/dist/lib/hls-setup.d.ts +0 -72
  70. package/dist/lib/hls-setup.js +0 -144
  71. package/dist/lib/hls-utils.d.ts +0 -31
  72. package/dist/lib/hls-utils.js +0 -34
  73. package/dist/lib/image-render.d.ts +0 -29
  74. package/dist/lib/image-render.js +0 -63
  75. package/dist/lib/keyboard-config.d.ts +0 -66
  76. package/dist/lib/keyboard-config.js +0 -127
  77. package/dist/lib/keyboard-utils.d.ts +0 -4
  78. package/dist/lib/keyboard-utils.js +0 -11
  79. package/dist/lib/lifecycle-effects.d.ts +0 -67
  80. package/dist/lib/lifecycle-effects.js +0 -78
  81. package/dist/lib/loading-debounce.d.ts +0 -26
  82. package/dist/lib/loading-debounce.js +0 -38
  83. package/dist/lib/numbers.d.ts +0 -6
  84. package/dist/lib/numbers.js +0 -36
  85. package/dist/lib/pip-utils.d.ts +0 -16
  86. package/dist/lib/pip-utils.js +0 -32
  87. package/dist/lib/playback-handlers.d.ts +0 -33
  88. package/dist/lib/playback-handlers.js +0 -51
  89. package/dist/lib/playback-slider.d.ts +0 -23
  90. package/dist/lib/playback-slider.js +0 -24
  91. package/dist/lib/player-labels.d.ts +0 -23
  92. package/dist/lib/player-labels.js +0 -132
  93. package/dist/lib/player-menu-labels.d.ts +0 -80
  94. package/dist/lib/player-menu-labels.js +0 -829
  95. package/dist/lib/player-ui-actions.d.ts +0 -10
  96. package/dist/lib/player-ui-actions.js +0 -58
  97. package/dist/lib/progress-fraction.d.ts +0 -11
  98. package/dist/lib/progress-fraction.js +0 -20
  99. package/dist/lib/progress-persist.d.ts +0 -28
  100. package/dist/lib/progress-persist.js +0 -54
  101. package/dist/lib/segment-analytics.d.ts +0 -20
  102. package/dist/lib/segment-analytics.js +0 -29
  103. package/dist/lib/subtitle-logic.d.ts +0 -31
  104. package/dist/lib/subtitle-logic.js +0 -75
  105. package/dist/lib/subtitle-utils.d.ts +0 -16
  106. package/dist/lib/subtitle-utils.js +0 -37
  107. package/dist/lib/time.d.ts +0 -1
  108. package/dist/lib/time.js +0 -17
  109. package/dist/lib/track-persistence.d.ts +0 -4
  110. package/dist/lib/track-persistence.js +0 -35
  111. package/dist/lib/video-preload-config.d.ts +0 -34
  112. package/dist/lib/video-preload-config.js +0 -41
  113. package/dist/lib/video-spinner.d.ts +0 -25
  114. package/dist/lib/video-spinner.js +0 -35
  115. package/dist/lib/video-stats.d.ts +0 -28
  116. package/dist/lib/video-stats.js +0 -44
  117. package/dist/lib/volume-utils.d.ts +0 -59
  118. package/dist/lib/volume-utils.js +0 -55
  119. package/dist/progressbar.d.ts +0 -10
  120. package/dist/progressbar.js +0 -125
  121. package/dist/store/analytics-context-store.d.ts +0 -4
  122. package/dist/store/analytics-context-store.js +0 -13
  123. package/dist/store/analytics-device-store.d.ts +0 -8
  124. package/dist/store/analytics-device-store.js +0 -44
  125. package/dist/store/analytics-session-store.d.ts +0 -8
  126. package/dist/store/analytics-session-store.js +0 -40
  127. package/dist/store/analytics-store.d.ts +0 -30
  128. package/dist/store/analytics-store.js +0 -88
  129. package/dist/store/controls-store.d.ts +0 -16
  130. package/dist/store/controls-store.js +0 -53
  131. package/dist/store/feed-cache-store.d.ts +0 -24
  132. package/dist/store/feed-cache-store.js +0 -165
  133. package/dist/store/feed-interaction-store.d.ts +0 -17
  134. package/dist/store/feed-interaction-store.js +0 -32
  135. package/dist/store/feed-store.d.ts +0 -16
  136. package/dist/store/feed-store.js +0 -38
  137. package/dist/store/generic-store.js +0 -24
  138. package/dist/store/image-store.d.ts +0 -2
  139. package/dist/store/image-store.js +0 -8
  140. package/dist/store/player-container-element-store.d.ts +0 -10
  141. package/dist/store/player-container-element-store.js +0 -38
  142. package/dist/store/player-global-actions.js +0 -53
  143. package/dist/store/player-media-element-store.d.ts +0 -10
  144. package/dist/store/player-media-element-store.js +0 -38
  145. package/dist/store/player-store-actions.js +0 -197
  146. package/dist/store/player-store.d.ts +0 -94
  147. package/dist/store/player-store.js +0 -127
  148. package/dist/store/player-track-actions.js +0 -44
  149. package/dist/store/postStore.d.ts +0 -20
  150. package/dist/store/postStore.js +0 -112
  151. package/dist/store/settings/constants.d.ts +0 -15
  152. package/dist/store/settings/constants.js +0 -47
  153. package/dist/store/settings/defaults.d.ts +0 -2
  154. package/dist/store/settings/defaults.js +0 -24
  155. package/dist/store/settings/storage.d.ts +0 -3
  156. package/dist/store/settings/storage.js +0 -28
  157. package/dist/store/settings/store.d.ts +0 -32
  158. package/dist/store/settings/store.js +0 -59
  159. package/dist/store/settings/types.d.ts +0 -27
  160. package/dist/store/settings/validation.d.ts +0 -7
  161. package/dist/store/settings/validation.js +0 -55
  162. package/dist/store/settings-menu-store.d.ts +0 -19
  163. package/dist/store/settings-menu-store.js +0 -30
  164. package/dist/store/video-store.d.ts +0 -2
  165. package/dist/store/video-store.js +0 -8
  166. package/dist/types/analytics.d.ts +0 -113
  167. package/dist/types/feed.d.ts +0 -21
  168. package/dist/types/file.d.ts +0 -12
  169. package/dist/types/heatmap.d.ts +0 -5
  170. package/dist/types/hot-segments.d.ts +0 -9
  171. package/dist/types/image.d.ts +0 -9
  172. package/dist/types/uuid.d.ts +0 -1
  173. 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
- }