@xsolla/xui-b2c-video-player 0.217.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/README.md +3 -0
- package/native/index.d.mts +111 -0
- package/native/index.d.ts +111 -0
- package/native/index.js +545 -0
- package/native/index.js.map +1 -0
- package/native/index.mjs +528 -0
- package/native/index.mjs.map +1 -0
- package/package.json +63 -0
- package/web/index.d.mts +111 -0
- package/web/index.d.ts +111 -0
- package/web/index.js +584 -0
- package/web/index.js.map +1 -0
- package/web/index.mjs +553 -0
- package/web/index.mjs.map +1 -0
package/web/index.d.mts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ThemeOverrideProps, ThemeMode } from '@xsolla/xui-core';
|
|
3
|
+
import { CurrencyType } from '@xsolla/xui-b2c-currency-tag';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Layout of the player chrome.
|
|
7
|
+
*
|
|
8
|
+
* - `full` — reward chips, title/description copy, and the control bar.
|
|
9
|
+
* - `compact` — the control bar only.
|
|
10
|
+
*/
|
|
11
|
+
type VideoPlayerView = "full" | "compact";
|
|
12
|
+
/** Colour tone accepted by the reward chips (mirrors `Tag`'s `tone`). */
|
|
13
|
+
type VideoPlayerRewardTone = "primary" | "brand" | "brandExtra" | "success" | "warning" | "alert" | "neutral";
|
|
14
|
+
/** A category chip rendered with `Tag` above the copy block in the `full` view. */
|
|
15
|
+
interface VideoPlayerLabelReward {
|
|
16
|
+
/** Stable key for the chip. */
|
|
17
|
+
key: string;
|
|
18
|
+
/** Discriminator. Omit or set `"label"` for a `Tag` chip. */
|
|
19
|
+
kind?: "label";
|
|
20
|
+
/** Chip label, e.g. `"Good Loot"`. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Optional leading icon. */
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Colour tone of the chip. Defaults to `"primary"`.
|
|
26
|
+
* `"success"` applies the light-mode wash used by the Figma loot preset.
|
|
27
|
+
*/
|
|
28
|
+
tone?: VideoPlayerRewardTone;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A virtual-currency amount rendered with `CurrencyTag`.
|
|
32
|
+
* Figma: the `CurrencyTag` instance beside the loot preset (node `1912:8418`).
|
|
33
|
+
*/
|
|
34
|
+
interface VideoPlayerCurrencyReward {
|
|
35
|
+
/** Stable key for the chip. */
|
|
36
|
+
key: string;
|
|
37
|
+
kind: "currency";
|
|
38
|
+
/** Amount shown in the chip, e.g. `"250"` or `"+250"`. */
|
|
39
|
+
value: ReactNode;
|
|
40
|
+
/** Currency the chip represents. Defaults to `"xsolla-points"`. */
|
|
41
|
+
currency?: CurrencyType;
|
|
42
|
+
/** Previous amount, rendered struck through before `value`. */
|
|
43
|
+
sublabel?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/** A single reward chip rendered above the copy block in the `full` view. */
|
|
46
|
+
type VideoPlayerRewardChip = VideoPlayerLabelReward | VideoPlayerCurrencyReward;
|
|
47
|
+
interface VideoPlayerProps extends ThemeOverrideProps {
|
|
48
|
+
/** Which layout to render. Defaults to `"full"`. */
|
|
49
|
+
view?: VideoPlayerView;
|
|
50
|
+
/** Headline shown above the control bar. Hidden in the `compact` view. */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** Supporting copy shown under the title. Hidden in the `compact` view. */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Reward chips shown above the copy. Hidden in the `compact` view. */
|
|
55
|
+
rewards?: VideoPlayerRewardChip[];
|
|
56
|
+
/**
|
|
57
|
+
* Playback position in seconds. When omitted the component tracks the
|
|
58
|
+
* position internally so the clock still follows the seek slider.
|
|
59
|
+
*/
|
|
60
|
+
currentTime?: number;
|
|
61
|
+
/** Total length of the media in seconds. Defaults to `0`. */
|
|
62
|
+
duration?: number;
|
|
63
|
+
/** Whether playback is running. Controlled when provided. */
|
|
64
|
+
playing?: boolean;
|
|
65
|
+
/** Whether audio is muted. Controlled when provided. */
|
|
66
|
+
muted?: boolean;
|
|
67
|
+
/** Whether the player is expanded to full screen. Controlled when provided. */
|
|
68
|
+
expanded?: boolean;
|
|
69
|
+
/** Disables every control in the bar. */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** Fired with the next playing state when play/pause is pressed. */
|
|
72
|
+
onPlayPause?: (playing: boolean) => void;
|
|
73
|
+
/** Fired with the next muted state when the mute control is pressed. */
|
|
74
|
+
onMute?: (muted: boolean) => void;
|
|
75
|
+
/** Fired with the next expanded state when the expand control is pressed. */
|
|
76
|
+
onExpand?: (expanded: boolean) => void;
|
|
77
|
+
/** Fired with the new position in seconds while seeking. */
|
|
78
|
+
onSeek?: (seconds: number) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Theme mode used for the control-bar chrome. The bar sits on top of a video
|
|
81
|
+
* surface, so it is pinned to `"dark"` by default to stay legible regardless
|
|
82
|
+
* of the ambient `XUIProvider` mode. Title and description use
|
|
83
|
+
* `content/static-light` for the same reason.
|
|
84
|
+
*/
|
|
85
|
+
overlayThemeMode?: ThemeMode;
|
|
86
|
+
/** Accessible label for the player group. Defaults to `"Video player"`. */
|
|
87
|
+
"aria-label"?: string;
|
|
88
|
+
testID?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Formats a position in seconds as `mm:ss`. Values past an hour keep counting
|
|
93
|
+
* in minutes (`72:30`) rather than growing a third segment, matching the
|
|
94
|
+
* fixed-width clock slot in the design.
|
|
95
|
+
*/
|
|
96
|
+
declare const formatPlaybackTime: (seconds: number) => string;
|
|
97
|
+
/**
|
|
98
|
+
* B2C video player overlay chrome.
|
|
99
|
+
*
|
|
100
|
+
* This is **not** an HTML5 `<video>` wrapper — it renders the chrome that sits
|
|
101
|
+
* on top of a video surface: optional reward chips (`Tag` and `CurrencyTag`),
|
|
102
|
+
* title and description copy, and a control bar with play/pause, a seek
|
|
103
|
+
* slider, the elapsed clock, mute, and expand/collapse.
|
|
104
|
+
*
|
|
105
|
+
* Spec: Figma `VideoPlayer` component set —
|
|
106
|
+
* https://www.figma.com/design/SOOtaT80JAVJf7PKlFnt7Q/B2C-Components%E2%80%A8Xsolla-UI-Toolkit?node-id=1909-5990
|
|
107
|
+
* (node `1923:9871`).
|
|
108
|
+
*/
|
|
109
|
+
declare const VideoPlayer: React.FC<VideoPlayerProps>;
|
|
110
|
+
|
|
111
|
+
export { VideoPlayer, type VideoPlayerCurrencyReward, type VideoPlayerLabelReward, type VideoPlayerProps, type VideoPlayerRewardChip, type VideoPlayerRewardTone, type VideoPlayerView, formatPlaybackTime };
|
package/web/index.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ThemeOverrideProps, ThemeMode } from '@xsolla/xui-core';
|
|
3
|
+
import { CurrencyType } from '@xsolla/xui-b2c-currency-tag';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Layout of the player chrome.
|
|
7
|
+
*
|
|
8
|
+
* - `full` — reward chips, title/description copy, and the control bar.
|
|
9
|
+
* - `compact` — the control bar only.
|
|
10
|
+
*/
|
|
11
|
+
type VideoPlayerView = "full" | "compact";
|
|
12
|
+
/** Colour tone accepted by the reward chips (mirrors `Tag`'s `tone`). */
|
|
13
|
+
type VideoPlayerRewardTone = "primary" | "brand" | "brandExtra" | "success" | "warning" | "alert" | "neutral";
|
|
14
|
+
/** A category chip rendered with `Tag` above the copy block in the `full` view. */
|
|
15
|
+
interface VideoPlayerLabelReward {
|
|
16
|
+
/** Stable key for the chip. */
|
|
17
|
+
key: string;
|
|
18
|
+
/** Discriminator. Omit or set `"label"` for a `Tag` chip. */
|
|
19
|
+
kind?: "label";
|
|
20
|
+
/** Chip label, e.g. `"Good Loot"`. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Optional leading icon. */
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Colour tone of the chip. Defaults to `"primary"`.
|
|
26
|
+
* `"success"` applies the light-mode wash used by the Figma loot preset.
|
|
27
|
+
*/
|
|
28
|
+
tone?: VideoPlayerRewardTone;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A virtual-currency amount rendered with `CurrencyTag`.
|
|
32
|
+
* Figma: the `CurrencyTag` instance beside the loot preset (node `1912:8418`).
|
|
33
|
+
*/
|
|
34
|
+
interface VideoPlayerCurrencyReward {
|
|
35
|
+
/** Stable key for the chip. */
|
|
36
|
+
key: string;
|
|
37
|
+
kind: "currency";
|
|
38
|
+
/** Amount shown in the chip, e.g. `"250"` or `"+250"`. */
|
|
39
|
+
value: ReactNode;
|
|
40
|
+
/** Currency the chip represents. Defaults to `"xsolla-points"`. */
|
|
41
|
+
currency?: CurrencyType;
|
|
42
|
+
/** Previous amount, rendered struck through before `value`. */
|
|
43
|
+
sublabel?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/** A single reward chip rendered above the copy block in the `full` view. */
|
|
46
|
+
type VideoPlayerRewardChip = VideoPlayerLabelReward | VideoPlayerCurrencyReward;
|
|
47
|
+
interface VideoPlayerProps extends ThemeOverrideProps {
|
|
48
|
+
/** Which layout to render. Defaults to `"full"`. */
|
|
49
|
+
view?: VideoPlayerView;
|
|
50
|
+
/** Headline shown above the control bar. Hidden in the `compact` view. */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** Supporting copy shown under the title. Hidden in the `compact` view. */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Reward chips shown above the copy. Hidden in the `compact` view. */
|
|
55
|
+
rewards?: VideoPlayerRewardChip[];
|
|
56
|
+
/**
|
|
57
|
+
* Playback position in seconds. When omitted the component tracks the
|
|
58
|
+
* position internally so the clock still follows the seek slider.
|
|
59
|
+
*/
|
|
60
|
+
currentTime?: number;
|
|
61
|
+
/** Total length of the media in seconds. Defaults to `0`. */
|
|
62
|
+
duration?: number;
|
|
63
|
+
/** Whether playback is running. Controlled when provided. */
|
|
64
|
+
playing?: boolean;
|
|
65
|
+
/** Whether audio is muted. Controlled when provided. */
|
|
66
|
+
muted?: boolean;
|
|
67
|
+
/** Whether the player is expanded to full screen. Controlled when provided. */
|
|
68
|
+
expanded?: boolean;
|
|
69
|
+
/** Disables every control in the bar. */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** Fired with the next playing state when play/pause is pressed. */
|
|
72
|
+
onPlayPause?: (playing: boolean) => void;
|
|
73
|
+
/** Fired with the next muted state when the mute control is pressed. */
|
|
74
|
+
onMute?: (muted: boolean) => void;
|
|
75
|
+
/** Fired with the next expanded state when the expand control is pressed. */
|
|
76
|
+
onExpand?: (expanded: boolean) => void;
|
|
77
|
+
/** Fired with the new position in seconds while seeking. */
|
|
78
|
+
onSeek?: (seconds: number) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Theme mode used for the control-bar chrome. The bar sits on top of a video
|
|
81
|
+
* surface, so it is pinned to `"dark"` by default to stay legible regardless
|
|
82
|
+
* of the ambient `XUIProvider` mode. Title and description use
|
|
83
|
+
* `content/static-light` for the same reason.
|
|
84
|
+
*/
|
|
85
|
+
overlayThemeMode?: ThemeMode;
|
|
86
|
+
/** Accessible label for the player group. Defaults to `"Video player"`. */
|
|
87
|
+
"aria-label"?: string;
|
|
88
|
+
testID?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Formats a position in seconds as `mm:ss`. Values past an hour keep counting
|
|
93
|
+
* in minutes (`72:30`) rather than growing a third segment, matching the
|
|
94
|
+
* fixed-width clock slot in the design.
|
|
95
|
+
*/
|
|
96
|
+
declare const formatPlaybackTime: (seconds: number) => string;
|
|
97
|
+
/**
|
|
98
|
+
* B2C video player overlay chrome.
|
|
99
|
+
*
|
|
100
|
+
* This is **not** an HTML5 `<video>` wrapper — it renders the chrome that sits
|
|
101
|
+
* on top of a video surface: optional reward chips (`Tag` and `CurrencyTag`),
|
|
102
|
+
* title and description copy, and a control bar with play/pause, a seek
|
|
103
|
+
* slider, the elapsed clock, mute, and expand/collapse.
|
|
104
|
+
*
|
|
105
|
+
* Spec: Figma `VideoPlayer` component set —
|
|
106
|
+
* https://www.figma.com/design/SOOtaT80JAVJf7PKlFnt7Q/B2C-Components%E2%80%A8Xsolla-UI-Toolkit?node-id=1909-5990
|
|
107
|
+
* (node `1923:9871`).
|
|
108
|
+
*/
|
|
109
|
+
declare const VideoPlayer: React.FC<VideoPlayerProps>;
|
|
110
|
+
|
|
111
|
+
export { VideoPlayer, type VideoPlayerCurrencyReward, type VideoPlayerLabelReward, type VideoPlayerProps, type VideoPlayerRewardChip, type VideoPlayerRewardTone, type VideoPlayerView, formatPlaybackTime };
|