@banou/media-player 0.2.6 → 0.4.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 +0 -10
- package/build/components/chrome.d.ts +4 -0
- package/build/components/control-bar.d.ts +5 -0
- package/build/components/overlay.d.ts +1 -0
- package/build/components/progress-bar.d.ts +1 -0
- package/build/components/settings.d.ts +2 -0
- package/build/components/sound.d.ts +4 -0
- package/build/components/tooltip-display.d.ts +20 -0
- package/build/components/volume-slider.d.ts +6 -0
- package/build/index.d.ts +23 -48
- package/build/index.js +2593 -2230
- package/build/main.d.ts +1 -1
- package/build/state-machines/data-source.d.ts +27 -0
- package/build/state-machines/index.d.ts +33185 -0
- package/build/state-machines/media-properties.d.ts +45 -0
- package/build/state-machines/media-source.d.ts +34 -0
- package/build/state-machines/media.d.ts +8344 -0
- package/build/state-machines/subtitles.d.ts +53 -0
- package/build/state-machines/thumbnails.d.ts +24 -0
- package/build/state-machines/utils.d.ts +26 -0
- package/build/utils/actor-utils.d.ts +2 -0
- package/build/utils/colors.d.ts +8 -0
- package/build/utils/context.d.ts +14 -0
- package/build/utils/fonts.d.ts +28 -0
- package/build/{utils.d.ts → utils/index.d.ts} +4 -12
- package/build/utils/languages.d.ts +260 -0
- package/build/{mp4box.d.ts → utils/mp4box.d.ts} +61 -61
- package/build/utils/time.d.ts +2 -0
- package/build/utils/use-local-storage.d.ts +3 -0
- package/build/{use-scrub.d.ts → utils/use-scrub.d.ts} +11 -10
- package/build/utils/volume-utils.d.ts +17 -0
- package/build/utils/window-height.d.ts +2 -0
- package/package.json +15 -12
- package/src/assets/picture-in-picture.svg +5 -0
- package/src/components/chrome.tsx +89 -0
- package/src/components/control-bar.tsx +330 -0
- package/src/components/overlay.tsx +28 -0
- package/src/components/progress-bar.tsx +252 -0
- package/src/components/settings.tsx +269 -0
- package/src/components/sound.tsx +101 -0
- package/src/components/tooltip-display.tsx +83 -0
- package/src/components/volume-slider.tsx +156 -0
- package/src/index.tsx +145 -434
- package/src/main.tsx +66 -39
- package/src/state-machines/data-source.ts +83 -0
- package/src/state-machines/index.ts +5 -0
- package/src/state-machines/media-properties.ts +78 -0
- package/src/state-machines/media-source.ts +129 -0
- package/src/state-machines/media.ts +245 -0
- package/src/state-machines/subtitles.ts +247 -0
- package/src/state-machines/thumbnails.ts +123 -0
- package/src/state-machines/utils.ts +94 -0
- package/src/utils/actor-utils.ts +19 -0
- package/src/utils/colors.ts +9 -0
- package/src/utils/context.ts +23 -0
- package/src/utils/fonts.ts +156 -0
- package/src/{utils.ts → utils/index.ts} +2 -26
- package/src/utils/time.ts +16 -0
- package/src/utils/use-local-storage.ts +30 -0
- package/src/{use-scrub.ts → utils/use-scrub.ts} +2 -1
- package/src/utils/volume-utils.ts +39 -0
- package/src/utils/window-height.ts +19 -0
- package/src/vite-env.d.ts +1 -1
- package/tsconfig.json +4 -2
- package/tsconfig.node.json +9 -9
- package/build/chrome/bottom.d.ts +0 -20
- package/build/chrome/index.d.ts +0 -27
- package/build/chrome/overlay.d.ts +0 -9
- package/build/languages.d.ts +0 -260
- package/build/use-local-storage.d.ts +0 -6
- package/src/chrome/bottom.tsx +0 -651
- package/src/chrome/index.tsx +0 -199
- package/src/chrome/overlay.tsx +0 -104
- package/src/use-local-storage.ts +0 -32
- /package/src/{languages.ts → utils/languages.ts} +0 -0
- /package/src/{mp4box.ts → utils/mp4box.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ParsedASS } from 'ass-compiler';
|
|
2
|
+
import type { ASS_Event, JassubOptions } from 'jassub';
|
|
3
|
+
import { Attachment, SubtitleFragment } from 'libav-wasm/build/worker';
|
|
4
|
+
type SubtitlesEvents = {
|
|
5
|
+
type: 'NEW_SUBTITLE_FRAGMENTS';
|
|
6
|
+
subtitles: SubtitleFragment[];
|
|
7
|
+
} | {
|
|
8
|
+
type: 'NEW_ATTACHMENTS';
|
|
9
|
+
attachments: Attachment[];
|
|
10
|
+
} | {
|
|
11
|
+
type: 'SELECT_SUBTITLE_STREAM';
|
|
12
|
+
streamIndex: number;
|
|
13
|
+
};
|
|
14
|
+
type SubtitlesEmittedEvents = {
|
|
15
|
+
type: 'WAITING';
|
|
16
|
+
} | {
|
|
17
|
+
type: 'SUBTITLE_STREAMS_UPDATED';
|
|
18
|
+
subtitlesStreams: SubtitleStream[];
|
|
19
|
+
} | {
|
|
20
|
+
type: 'SELECTED_SUBTITLE_STREAM_UPDATED';
|
|
21
|
+
streamIndex: number;
|
|
22
|
+
};
|
|
23
|
+
type SubtitlesInput = {
|
|
24
|
+
publicPath: string;
|
|
25
|
+
videoElement: HTMLVideoElement;
|
|
26
|
+
canvasElement: HTMLCanvasElement;
|
|
27
|
+
subtitlesRendererOptions: Omit<JassubOptions, 'video' | 'canvas'>;
|
|
28
|
+
};
|
|
29
|
+
export type SubtitlePart = {
|
|
30
|
+
type: 'header';
|
|
31
|
+
streamIndex: number;
|
|
32
|
+
content: string;
|
|
33
|
+
eventsContent: string;
|
|
34
|
+
dialogueFormatContent: string;
|
|
35
|
+
parsed: ParsedASS;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'dialogue';
|
|
38
|
+
streamIndex: number;
|
|
39
|
+
index: number;
|
|
40
|
+
content: string;
|
|
41
|
+
parsed: ParsedASS;
|
|
42
|
+
assEvent: ASS_Event;
|
|
43
|
+
};
|
|
44
|
+
export type SubtitleStream = {
|
|
45
|
+
header: SubtitlePart & {
|
|
46
|
+
type: 'header';
|
|
47
|
+
};
|
|
48
|
+
dialogues: (SubtitlePart & {
|
|
49
|
+
type: 'dialogue';
|
|
50
|
+
})[];
|
|
51
|
+
};
|
|
52
|
+
declare const _default: import("xstate").CallbackActorLogic<SubtitlesEvents, SubtitlesInput, SubtitlesEmittedEvents>;
|
|
53
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Index } from 'libav-wasm/build/worker';
|
|
2
|
+
import { makeRemuxer } from 'libav-wasm';
|
|
3
|
+
import { DownloadedRange } from '../utils/context';
|
|
4
|
+
type ExtendedIndex = Index & {
|
|
5
|
+
duration?: number;
|
|
6
|
+
};
|
|
7
|
+
export type Thumbnail = {
|
|
8
|
+
url: string;
|
|
9
|
+
blob: Blob;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
index: ExtendedIndex;
|
|
13
|
+
};
|
|
14
|
+
type DataSourceInput = {
|
|
15
|
+
remuxerOptions: Parameters<typeof makeRemuxer>[0];
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import("xstate").CallbackActorLogic<{
|
|
18
|
+
type: "DOWNLOADED_RANGES_UPDATED";
|
|
19
|
+
downloadedRanges: DownloadedRange[];
|
|
20
|
+
}, DataSourceInput, {
|
|
21
|
+
type: "NEW_THUMBNAIL";
|
|
22
|
+
thumbnail: Thumbnail;
|
|
23
|
+
}>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnyActorSystem } from 'xstate/dist/declarations/src/system';
|
|
2
|
+
import type { AnyEventObject, CallbackActorLogic, CallbackActorRef, EventObject, NonReducibleUnknown } from 'xstate';
|
|
3
|
+
type Receiver<TEvent extends EventObject> = (listener: {
|
|
4
|
+
bivarianceHack(event: TEvent): void;
|
|
5
|
+
}['bivarianceHack']) => void;
|
|
6
|
+
export type CallbackLogicFunction<TEvent extends EventObject = AnyEventObject, TSentEvent extends EventObject = AnyEventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ({ input, system, self, sendBack, receive, emit }: {
|
|
7
|
+
input: TInput;
|
|
8
|
+
system: AnyActorSystem;
|
|
9
|
+
self: CallbackActorRef<TEvent>;
|
|
10
|
+
sendBack: (event: TSentEvent) => void;
|
|
11
|
+
receive: Receiver<TEvent>;
|
|
12
|
+
emit: (emitted: TEmitted) => void;
|
|
13
|
+
}) => Promise<(() => void) | void>;
|
|
14
|
+
type FromAsyncCallback = <TEvent extends EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(callback: CallbackLogicFunction<TEvent, AnyEventObject, TInput, TEmitted>) => CallbackActorLogic<TEvent, TInput, TEmitted>;
|
|
15
|
+
export declare const fromAsyncCallback: FromAsyncCallback;
|
|
16
|
+
export declare const getTimeRanges: (sourceBuffer: SourceBuffer) => {
|
|
17
|
+
index: number;
|
|
18
|
+
start: number;
|
|
19
|
+
end: number;
|
|
20
|
+
}[];
|
|
21
|
+
export declare const updateSourceBuffer: (sourceBuffer: SourceBuffer) => {
|
|
22
|
+
appendBuffer: (buffer: ArrayBuffer) => Promise<void | Event>;
|
|
23
|
+
unbufferRange: (start: number, end: number) => Promise<unknown>;
|
|
24
|
+
updateTimestampOffset: (timestampOffset: number) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DownloadedRange = {
|
|
2
|
+
startByteOffset: number;
|
|
3
|
+
endByteOffset: number;
|
|
4
|
+
};
|
|
5
|
+
export type MediaPlayerContextType = {
|
|
6
|
+
videoElement?: HTMLVideoElement;
|
|
7
|
+
title?: string;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
downloadedRanges?: DownloadedRange[];
|
|
11
|
+
hideUI: boolean;
|
|
12
|
+
update: (context: Omit<MediaPlayerContextType, 'update'>) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const MediaPlayerContext: import("react").Context<MediaPlayerContextType>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const fonts: {
|
|
2
|
+
headings: {
|
|
3
|
+
large: string;
|
|
4
|
+
medium: string;
|
|
5
|
+
small: string;
|
|
6
|
+
extraSmall: string;
|
|
7
|
+
};
|
|
8
|
+
bLarge: {
|
|
9
|
+
bold: string;
|
|
10
|
+
medium: string;
|
|
11
|
+
regular: string;
|
|
12
|
+
};
|
|
13
|
+
bMedium: {
|
|
14
|
+
bold: string;
|
|
15
|
+
medium: string;
|
|
16
|
+
regular: string;
|
|
17
|
+
};
|
|
18
|
+
bSmall: {
|
|
19
|
+
bold: string;
|
|
20
|
+
medium: string;
|
|
21
|
+
regular: string;
|
|
22
|
+
};
|
|
23
|
+
bExtraSmall: {
|
|
24
|
+
bold: string;
|
|
25
|
+
medium: string;
|
|
26
|
+
regular: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
duration: number;
|
|
6
|
-
pos: number;
|
|
7
|
-
buffered: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare function debounceImmediateAndLatest<T extends (...args: any[]) => any>(wait: number, func: T): T;
|
|
10
|
-
export declare const queuedDebounceWithLastCall: <T2 extends any[], T extends (...args: T2) => any>(time: number, func: T) => (...args: Parameters<T>) => Promise<any> | undefined;
|
|
11
|
-
export declare const toStreamChunkSize: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array>;
|
|
12
|
-
export declare const toBufferedStream: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array>;
|
|
1
|
+
export declare function debounceImmediateAndLatest<T extends (...args: any[]) => any>(wait: number, func: T): T;
|
|
2
|
+
export declare const queuedThrottleWithLastCall: <T2 extends any[], T extends (...args: T2) => any>(time: number, func: T) => (...args: Parameters<T>) => Promise<any> | undefined;
|
|
3
|
+
export declare const toStreamChunkSize: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
4
|
+
export declare const toBufferedStream: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
type Language = {
|
|
2
|
+
tag: string;
|
|
3
|
+
name: string;
|
|
4
|
+
originalName: string;
|
|
5
|
+
locale: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const languages: Language[];
|
|
8
|
+
export declare const languageToTag: (lang: string) => string | undefined;
|
|
9
|
+
export declare const tagToLanguage: (langTag: string) => string | undefined;
|
|
10
|
+
export declare enum LanguageTag {
|
|
11
|
+
/** isiZulu */
|
|
12
|
+
ZU = "zu",// "isiZulu",
|
|
13
|
+
/** Chinese */
|
|
14
|
+
ZH = "zh",// "Chinese",
|
|
15
|
+
/** Yoruba */
|
|
16
|
+
YO = "yo",// "Yoruba",
|
|
17
|
+
/** isiXhosa */
|
|
18
|
+
XH = "xh",// "isiXhosa",
|
|
19
|
+
/** Wolof */
|
|
20
|
+
WO = "wo",// "Wolof",
|
|
21
|
+
/** Vietnamese */
|
|
22
|
+
VI = "vi",// "Vietnamese",
|
|
23
|
+
/** Uzbek */
|
|
24
|
+
UZ = "uz",// "Uzbek",
|
|
25
|
+
/** Urdu */
|
|
26
|
+
UR = "ur",// "Urdu",
|
|
27
|
+
/** Ukrainian */
|
|
28
|
+
UK = "uk",// "Ukrainian",
|
|
29
|
+
/** Uyghur */
|
|
30
|
+
UG = "ug",// "Uyghur",
|
|
31
|
+
/** Tamazight */
|
|
32
|
+
TZM = "tzm",// "Tamazight",
|
|
33
|
+
/** Tatar */
|
|
34
|
+
TT = "tt",// "Tatar",
|
|
35
|
+
/** Turkish */
|
|
36
|
+
TR = "tr",// "Turkish",
|
|
37
|
+
/** Setswana */
|
|
38
|
+
TN = "tn",// "Setswana",
|
|
39
|
+
/** Turkmen */
|
|
40
|
+
TK = "tk",// "Turkmen",
|
|
41
|
+
/** Thai */
|
|
42
|
+
TH = "th",// "Thai",
|
|
43
|
+
/** Tajik */
|
|
44
|
+
TG = "tg",// "Tajik",
|
|
45
|
+
/** Telugu */
|
|
46
|
+
TE = "te",// "Telugu",
|
|
47
|
+
/** Tamil */
|
|
48
|
+
TA = "ta",// "Tamil",
|
|
49
|
+
/** Syriac */
|
|
50
|
+
SYR = "syr",// "Syriac",
|
|
51
|
+
/** Kiswahili */
|
|
52
|
+
SW = "sw",// "Kiswahili",
|
|
53
|
+
/** Swedish */
|
|
54
|
+
SV = "sv",// "Swedish",
|
|
55
|
+
/** Serbian */
|
|
56
|
+
SR = "sr",// "Serbian",
|
|
57
|
+
/** Albanian */
|
|
58
|
+
SQ = "sq",// "Albanian",
|
|
59
|
+
/** Sami */
|
|
60
|
+
SMS = "sms",// "Sami",
|
|
61
|
+
/** Sami */
|
|
62
|
+
SMN = "smn",// "Sami",
|
|
63
|
+
/** Sami */
|
|
64
|
+
SMJ = "smj",// "Sami",
|
|
65
|
+
/** Sami */
|
|
66
|
+
SMA = "sma",// "Sami",
|
|
67
|
+
/** Slovenian */
|
|
68
|
+
SL = "sl",// "Slovenian",
|
|
69
|
+
/** Slovak */
|
|
70
|
+
SK = "sk",// "Slovak",
|
|
71
|
+
/** Sinhala */
|
|
72
|
+
SI = "si",// "Sinhala",
|
|
73
|
+
/** Sami */
|
|
74
|
+
SE = "se",// "Sami",
|
|
75
|
+
/** Yakut */
|
|
76
|
+
SAH = "sah",// "Yakut",
|
|
77
|
+
/** Sanskrit */
|
|
78
|
+
SA = "sa",// "Sanskrit",
|
|
79
|
+
/** Kinyarwanda */
|
|
80
|
+
RW = "rw",// "Kinyarwanda",
|
|
81
|
+
/** Russian */
|
|
82
|
+
RU = "ru",// "Russian",
|
|
83
|
+
/** Romanian */
|
|
84
|
+
RO = "ro",// "Romanian",
|
|
85
|
+
/** Romansh */
|
|
86
|
+
RM = "rm",// "Romansh",
|
|
87
|
+
/** Quechua */
|
|
88
|
+
QUZ = "quz",// "Quechua",
|
|
89
|
+
/** K */
|
|
90
|
+
QUT = "qut",// "K'iche",
|
|
91
|
+
/** Portuguese */
|
|
92
|
+
PT = "pt",// "Portuguese",
|
|
93
|
+
/** Pashto */
|
|
94
|
+
PS = "ps",// "Pashto",
|
|
95
|
+
/** Dari */
|
|
96
|
+
PRS = "prs",// "Dari",
|
|
97
|
+
/** Polish */
|
|
98
|
+
PL = "pl",// "Polish",
|
|
99
|
+
/** Punjabi */
|
|
100
|
+
PA = "pa",// "Punjabi",
|
|
101
|
+
/** Oriya */
|
|
102
|
+
OR = "or",// "Oriya",
|
|
103
|
+
/** Occitan */
|
|
104
|
+
OC = "oc",// "Occitan",
|
|
105
|
+
/** Sesotho sa Leboa */
|
|
106
|
+
NSO = "nso",// "Sesotho sa Leboa",
|
|
107
|
+
/** Norwegian */
|
|
108
|
+
NO = "no",// "Norwegian",
|
|
109
|
+
/** Norwegian, Nynorsk */
|
|
110
|
+
NN = "nn",// "Norwegian, Nynorsk",
|
|
111
|
+
/** Dutch */
|
|
112
|
+
NL = "nl",// "Dutch",
|
|
113
|
+
/** Nepali */
|
|
114
|
+
NE = "ne",// "Nepali",
|
|
115
|
+
/** Norwegian, Bokmål */
|
|
116
|
+
NB = "nb",// "Norwegian, Bokmål",
|
|
117
|
+
/** Maltese */
|
|
118
|
+
MT = "mt",// "Maltese",
|
|
119
|
+
/** Malay */
|
|
120
|
+
MS = "ms",// "Malay",
|
|
121
|
+
/** Marathi */
|
|
122
|
+
MR = "mr",// "Marathi",
|
|
123
|
+
/** Mohawk */
|
|
124
|
+
MOH = "moh",// "Mohawk",
|
|
125
|
+
/** Mongolian */
|
|
126
|
+
MN = "mn",// "Mongolian",
|
|
127
|
+
/** Malayalam */
|
|
128
|
+
ML = "ml",// "Malayalam",
|
|
129
|
+
/** Macedonian */
|
|
130
|
+
MK = "mk",// "Macedonian",
|
|
131
|
+
/** Maori */
|
|
132
|
+
MI = "mi",// "Maori",
|
|
133
|
+
/** Latvian */
|
|
134
|
+
LV = "lv",// "Latvian",
|
|
135
|
+
/** Lithuanian */
|
|
136
|
+
LT = "lt",// "Lithuanian",
|
|
137
|
+
/** Lao */
|
|
138
|
+
LO = "lo",// "Lao",
|
|
139
|
+
/** Luxembourgish */
|
|
140
|
+
LB = "lb",// "Luxembourgish",
|
|
141
|
+
/** Kyrgyz */
|
|
142
|
+
KY = "ky",// "Kyrgyz",
|
|
143
|
+
/** Konkani */
|
|
144
|
+
KOK = "kok",// "Konkani",
|
|
145
|
+
/** Korean */
|
|
146
|
+
KO = "ko",// "Korean",
|
|
147
|
+
/** Kannada */
|
|
148
|
+
KN = "kn",// "Kannada",
|
|
149
|
+
/** Khmer */
|
|
150
|
+
KM = "km",// "Khmer",
|
|
151
|
+
/** Greenlandic */
|
|
152
|
+
KL = "kl",// "Greenlandic",
|
|
153
|
+
/** Kazakh */
|
|
154
|
+
KK = "kk",// "Kazakh",
|
|
155
|
+
/** Georgian */
|
|
156
|
+
KA = "ka",// "Georgian",
|
|
157
|
+
/** Japanese */
|
|
158
|
+
JA = "ja",// "Japanese",
|
|
159
|
+
/** Inuktitut */
|
|
160
|
+
IU = "iu",// "Inuktitut",
|
|
161
|
+
/** Italian */
|
|
162
|
+
IT = "it",// "Italian",
|
|
163
|
+
/** Icelandic */
|
|
164
|
+
IS = "is",// "Icelandic",
|
|
165
|
+
/** Yi */
|
|
166
|
+
II = "ii",// "Yi",
|
|
167
|
+
/** Igbo */
|
|
168
|
+
IG = "ig",// "Igbo",
|
|
169
|
+
/** Indonesian */
|
|
170
|
+
ID = "id",// "Indonesian",
|
|
171
|
+
/** Armenian */
|
|
172
|
+
HY = "hy",// "Armenian",
|
|
173
|
+
/** Hungarian */
|
|
174
|
+
HU = "hu",// "Hungarian",
|
|
175
|
+
/** Upper Sorbian */
|
|
176
|
+
HSB = "hsb",// "Upper Sorbian",
|
|
177
|
+
/** Croatian */
|
|
178
|
+
HR = "hr",// "Croatian",
|
|
179
|
+
/** Hindi */
|
|
180
|
+
HI = "hi",// "Hindi",
|
|
181
|
+
/** Hebrew */
|
|
182
|
+
HE = "he",// "Hebrew",
|
|
183
|
+
/** Hausa */
|
|
184
|
+
HA = "ha",// "Hausa",
|
|
185
|
+
/** Gujarati */
|
|
186
|
+
GU = "gu",// "Gujarati",
|
|
187
|
+
/** Alsatian */
|
|
188
|
+
GSW = "gsw",// "Alsatian",
|
|
189
|
+
/** Galician */
|
|
190
|
+
GL = "gl",// "Galician",
|
|
191
|
+
/** Scottish Gaelic */
|
|
192
|
+
GD = "gd",// "Scottish Gaelic",
|
|
193
|
+
/** Irish */
|
|
194
|
+
GA = "ga",// "Irish",
|
|
195
|
+
/** Frisian */
|
|
196
|
+
FY = "fy",// "Frisian",
|
|
197
|
+
/** French */
|
|
198
|
+
FR = "fr",// "French",
|
|
199
|
+
/** Faroese */
|
|
200
|
+
FO = "fo",// "Faroese",
|
|
201
|
+
/** Filipino */
|
|
202
|
+
FIL = "fil",// "Filipino",
|
|
203
|
+
/** Finnish */
|
|
204
|
+
FI = "fi",// "Finnish",
|
|
205
|
+
/** Persian */
|
|
206
|
+
FA = "fa",// "Persian",
|
|
207
|
+
/** Basque */
|
|
208
|
+
EU = "eu",// "Basque",
|
|
209
|
+
/** Estonian */
|
|
210
|
+
ET = "et",// "Estonian",
|
|
211
|
+
/** Spanish */
|
|
212
|
+
ES = "es",// "Spanish",
|
|
213
|
+
/** English */
|
|
214
|
+
EN = "en",// "English",
|
|
215
|
+
/** Greek */
|
|
216
|
+
EL = "el",// "Greek",
|
|
217
|
+
/** Divehi */
|
|
218
|
+
DV = "dv",// "Divehi",
|
|
219
|
+
/** Lower Sorbian */
|
|
220
|
+
DSB = "dsb",// "Lower Sorbian",
|
|
221
|
+
/** German */
|
|
222
|
+
DE = "de",// "German",
|
|
223
|
+
/** Danish */
|
|
224
|
+
DA = "da",// "Danish",
|
|
225
|
+
/** Welsh */
|
|
226
|
+
CY = "cy",// "Welsh",
|
|
227
|
+
/** Czech */
|
|
228
|
+
CS = "cs",// "Czech",
|
|
229
|
+
/** Corsican */
|
|
230
|
+
CO = "co",// "Corsican",
|
|
231
|
+
/** Catalan */
|
|
232
|
+
CA = "ca",// "Catalan",
|
|
233
|
+
/** Bosnian */
|
|
234
|
+
BS = "bs",// "Bosnian",
|
|
235
|
+
/** Breton */
|
|
236
|
+
BR = "br",// "Breton",
|
|
237
|
+
/** Tibetan */
|
|
238
|
+
BO = "bo",// "Tibetan",
|
|
239
|
+
/** Bengali */
|
|
240
|
+
BN = "bn",// "Bengali",
|
|
241
|
+
/** Bulgarian */
|
|
242
|
+
BG = "bg",// "Bulgarian",
|
|
243
|
+
/** Belarusian */
|
|
244
|
+
BE = "be",// "Belarusian",
|
|
245
|
+
/** Bashkir */
|
|
246
|
+
BA = "ba",// "Bashkir",
|
|
247
|
+
/** Azeri */
|
|
248
|
+
AZ = "az",// "Azeri",
|
|
249
|
+
/** Assamese */
|
|
250
|
+
AS = "as",// "Assamese",
|
|
251
|
+
/** Mapudungun */
|
|
252
|
+
ARN = "arn",// "Mapudungun",
|
|
253
|
+
/** Arabic */
|
|
254
|
+
AR = "ar",// "Arabic",
|
|
255
|
+
/** Amharic */
|
|
256
|
+
AM = "am",// "Amharic",
|
|
257
|
+
/** Afrikaans */
|
|
258
|
+
AF = "af"
|
|
259
|
+
}
|
|
260
|
+
export {};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
declare module "mp4box" {
|
|
2
|
-
interface MP4MediaTrack {
|
|
3
|
-
id: number;
|
|
4
|
-
created: Date;
|
|
5
|
-
modified: Date;
|
|
6
|
-
movie_duration: number;
|
|
7
|
-
layer: number;
|
|
8
|
-
alternate_group: number;
|
|
9
|
-
volume: number;
|
|
10
|
-
track_width: number;
|
|
11
|
-
track_height: number;
|
|
12
|
-
timescale: number;
|
|
13
|
-
duration: number;
|
|
14
|
-
bitrate: number;
|
|
15
|
-
codec: string;
|
|
16
|
-
language: string;
|
|
17
|
-
nb_samples: number;
|
|
18
|
-
}
|
|
19
|
-
interface MP4VideoData {
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
}
|
|
23
|
-
interface MP4VideoTrack extends MP4MediaTrack {
|
|
24
|
-
video: MP4VideoData;
|
|
25
|
-
}
|
|
26
|
-
interface MP4AudioData {
|
|
27
|
-
sample_rate: number;
|
|
28
|
-
channel_count: number;
|
|
29
|
-
sample_size: number;
|
|
30
|
-
}
|
|
31
|
-
interface MP4AudioTrack extends MP4MediaTrack {
|
|
32
|
-
audio: MP4AudioData;
|
|
33
|
-
}
|
|
34
|
-
type MP4Track = MP4VideoTrack | MP4AudioTrack;
|
|
35
|
-
interface MP4Info {
|
|
36
|
-
duration: number;
|
|
37
|
-
timescale: number;
|
|
38
|
-
fragment_duration: number;
|
|
39
|
-
isFragmented: boolean;
|
|
40
|
-
isProgressive: boolean;
|
|
41
|
-
hasIOD: boolean;
|
|
42
|
-
brands: string[];
|
|
43
|
-
created: Date;
|
|
44
|
-
modified: Date;
|
|
45
|
-
tracks: MP4Track[];
|
|
46
|
-
}
|
|
47
|
-
type MP4ArrayBuffer = ArrayBuffer & {
|
|
48
|
-
fileStart: number;
|
|
49
|
-
};
|
|
50
|
-
interface MP4File {
|
|
51
|
-
onMoovStart?: () => void;
|
|
52
|
-
onReady?: (info: MP4Info) => void;
|
|
53
|
-
onError?: (e: Error) => void;
|
|
54
|
-
appendBuffer(data: MP4ArrayBuffer): number;
|
|
55
|
-
start(): void;
|
|
56
|
-
stop(): void;
|
|
57
|
-
flush(): void;
|
|
58
|
-
}
|
|
59
|
-
function createFile(): MP4File;
|
|
60
|
-
}
|
|
61
|
-
export {};
|
|
1
|
+
declare module "mp4box" {
|
|
2
|
+
interface MP4MediaTrack {
|
|
3
|
+
id: number;
|
|
4
|
+
created: Date;
|
|
5
|
+
modified: Date;
|
|
6
|
+
movie_duration: number;
|
|
7
|
+
layer: number;
|
|
8
|
+
alternate_group: number;
|
|
9
|
+
volume: number;
|
|
10
|
+
track_width: number;
|
|
11
|
+
track_height: number;
|
|
12
|
+
timescale: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
bitrate: number;
|
|
15
|
+
codec: string;
|
|
16
|
+
language: string;
|
|
17
|
+
nb_samples: number;
|
|
18
|
+
}
|
|
19
|
+
interface MP4VideoData {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
interface MP4VideoTrack extends MP4MediaTrack {
|
|
24
|
+
video: MP4VideoData;
|
|
25
|
+
}
|
|
26
|
+
interface MP4AudioData {
|
|
27
|
+
sample_rate: number;
|
|
28
|
+
channel_count: number;
|
|
29
|
+
sample_size: number;
|
|
30
|
+
}
|
|
31
|
+
interface MP4AudioTrack extends MP4MediaTrack {
|
|
32
|
+
audio: MP4AudioData;
|
|
33
|
+
}
|
|
34
|
+
type MP4Track = MP4VideoTrack | MP4AudioTrack;
|
|
35
|
+
interface MP4Info {
|
|
36
|
+
duration: number;
|
|
37
|
+
timescale: number;
|
|
38
|
+
fragment_duration: number;
|
|
39
|
+
isFragmented: boolean;
|
|
40
|
+
isProgressive: boolean;
|
|
41
|
+
hasIOD: boolean;
|
|
42
|
+
brands: string[];
|
|
43
|
+
created: Date;
|
|
44
|
+
modified: Date;
|
|
45
|
+
tracks: MP4Track[];
|
|
46
|
+
}
|
|
47
|
+
type MP4ArrayBuffer = ArrayBuffer & {
|
|
48
|
+
fileStart: number;
|
|
49
|
+
};
|
|
50
|
+
interface MP4File {
|
|
51
|
+
onMoovStart?: () => void;
|
|
52
|
+
onReady?: (info: MP4Info) => void;
|
|
53
|
+
onError?: (e: Error) => void;
|
|
54
|
+
appendBuffer(data: MP4ArrayBuffer): number;
|
|
55
|
+
start(): void;
|
|
56
|
+
stop(): void;
|
|
57
|
+
flush(): void;
|
|
58
|
+
}
|
|
59
|
+
function createFile(): MP4File;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { MouseEventHandler, RefObject } from 'react';
|
|
2
|
-
declare const _default: ({ ref, defaultValue }: {
|
|
3
|
-
ref: RefObject<HTMLElement>;
|
|
4
|
-
defaultValue?: number
|
|
5
|
-
}) => {
|
|
6
|
-
value: number | undefined;
|
|
7
|
-
scrubbing: boolean;
|
|
8
|
-
scrub: MouseEventHandler<HTMLDivElement>;
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { MouseEventHandler, RefObject } from 'react';
|
|
2
|
+
declare const _default: ({ ref, defaultValue }: {
|
|
3
|
+
ref: RefObject<HTMLElement>;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
}) => {
|
|
6
|
+
value: number | undefined;
|
|
7
|
+
scrubbing: boolean;
|
|
8
|
+
scrub: MouseEventHandler<HTMLDivElement>;
|
|
9
|
+
setValue: import("react").Dispatch<import("react").SetStateAction<number | undefined>>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const VOLUME_EXPONENT = 2;
|
|
2
|
+
/**
|
|
3
|
+
* Converts a linear slider value (0-1) to logarithmic volume scale
|
|
4
|
+
* Uses formula: volume = minVolume * (maxVolume/minVolume)^position
|
|
5
|
+
*
|
|
6
|
+
* @param linearValue Linear slider position (0-1)
|
|
7
|
+
* @returns Logarithmic volume value (0-1)
|
|
8
|
+
*/
|
|
9
|
+
export declare const linearToLogVolume: (linearValue: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a logarithmic volume (0-1) back to linear slider position (0-1)
|
|
12
|
+
* Inverse of the logarithmic formula
|
|
13
|
+
*
|
|
14
|
+
* @param logVolume Logarithmic volume (0-1)
|
|
15
|
+
* @returns Linear slider position (0-1)
|
|
16
|
+
*/
|
|
17
|
+
export declare const logToLinearVolume: (logVolume: number) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@banou/media-player",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"dev": "vite --port 4560",
|
|
15
|
+
"build-dev": "vite build --watch",
|
|
15
16
|
"build": "vite build && npm run types",
|
|
16
17
|
"build-for-dev": "vite build && npm run copy-dependencies && npm run types",
|
|
17
18
|
"copy-dependencies": "npm run copy-libass && npm run copy-worker && npm run copy-worker-wasm",
|
|
@@ -25,24 +26,26 @@
|
|
|
25
26
|
"@types/node": "^18.11.18",
|
|
26
27
|
"@types/react": "^18.0.27",
|
|
27
28
|
"@types/react-dom": "^18.0.10",
|
|
28
|
-
"@vitejs/plugin-react": "^3.
|
|
29
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
29
30
|
"concurrently": "^7.6.0",
|
|
30
31
|
"copyfiles": "^2.4.1",
|
|
31
32
|
"mime": "^3.0.0",
|
|
32
|
-
"react-dom": "^18.2.0",
|
|
33
33
|
"shx": "^0.3.4",
|
|
34
|
-
"typescript": "^
|
|
35
|
-
"vite": "^
|
|
34
|
+
"typescript": "^5.8.2",
|
|
35
|
+
"vite": "^6.2.1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@emotion/react": "^11.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
38
|
+
"@emotion/react": "^11.14.0",
|
|
39
|
+
"@xstate/react": "^5.0.1",
|
|
40
|
+
"ass-compiler": "^0.1.15",
|
|
41
|
+
"jassub": "^1.7.18",
|
|
42
|
+
"libav-wasm": "^0.5.3",
|
|
43
|
+
"osra": "^0.1.2",
|
|
43
44
|
"p-queue": "^7.3.4",
|
|
44
|
-
"react": "^
|
|
45
|
+
"react": "^19.0.0",
|
|
46
|
+
"react-dom": "^19.0.0",
|
|
45
47
|
"react-feather": "^2.0.10",
|
|
46
|
-
"react-tooltip": "^
|
|
48
|
+
"react-tooltip": "^5.28.0",
|
|
49
|
+
"xstate": "^5.19.1"
|
|
47
50
|
}
|
|
48
51
|
}
|