@banou/media-player 0.6.2 → 0.7.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 +148 -3
- package/dist/engine/index.d.ts +10 -0
- package/dist/engine/index.js +2 -0
- package/dist/engine/picture-in-picture.d.ts +27 -0
- package/dist/engine/playback.d.ts +45 -0
- package/dist/engine/source-buffer.d.ts +12 -0
- package/dist/engine/subtitles.d.ts +36 -0
- package/dist/engine/thumbnails.d.ts +22 -0
- package/dist/engine-Dmc7JSd9.js +470 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1566 -0
- package/dist/react/components/chrome.d.ts +9 -0
- package/dist/react/components/control-bar.d.ts +2 -0
- package/dist/react/components/overlay.d.ts +4 -0
- package/dist/react/components/playback-slider.d.ts +2 -0
- package/dist/react/components/progress-bar.d.ts +2 -0
- package/dist/react/components/settings.d.ts +2 -0
- package/dist/react/components/sound.d.ts +7 -0
- package/{build → dist/react}/components/tooltip-display.d.ts +8 -8
- package/dist/react/components/volume-slider.d.ts +6 -0
- package/dist/react/hooks/use-drag-value.d.ts +23 -0
- package/dist/react/hooks/use-picture-in-picture.d.ts +2 -0
- package/dist/react/hooks/use-playback.d.ts +6 -0
- package/dist/react/hooks/use-thumbnails.d.ts +11 -0
- package/dist/react/player.d.ts +25 -0
- package/dist/react/source-feature.d.ts +84 -0
- package/dist/react/video-player.d.ts +43 -0
- package/dist/utils/source.d.ts +30 -0
- package/dist/utils/track-label.d.ts +19 -0
- package/dist/utils/volume-utils.d.ts +6 -0
- package/package.json +49 -37
- package/src/lib/engine/index.ts +14 -0
- package/src/lib/engine/picture-in-picture.ts +250 -0
- package/src/lib/engine/playback.ts +352 -0
- package/src/lib/engine/source-buffer.ts +61 -0
- package/src/lib/engine/subtitles.ts +210 -0
- package/src/lib/engine/thumbnails.ts +137 -0
- package/src/lib/globals.d.ts +8 -0
- package/src/lib/index.tsx +36 -0
- package/src/lib/react/components/chrome.tsx +126 -0
- package/src/{components → lib/react/components}/control-bar.tsx +74 -96
- package/src/lib/react/components/overlay.tsx +121 -0
- package/src/{components → lib/react/components}/playback-slider.tsx +30 -52
- package/src/{components → lib/react/components}/progress-bar.tsx +128 -41
- package/src/lib/react/components/settings.tsx +391 -0
- package/src/lib/react/components/sound.tsx +133 -0
- package/src/{components → lib/react/components}/tooltip-display.tsx +11 -8
- package/src/{components → lib/react/components}/volume-slider.tsx +32 -46
- package/src/lib/react/hooks/use-drag-value.ts +73 -0
- package/src/lib/react/hooks/use-picture-in-picture.ts +36 -0
- package/src/lib/react/hooks/use-playback.ts +134 -0
- package/src/lib/react/hooks/use-thumbnails.ts +77 -0
- package/src/lib/react/player.ts +20 -0
- package/src/lib/react/source-feature.ts +90 -0
- package/src/lib/react/video-player.tsx +119 -0
- package/src/lib/utils/source.ts +60 -0
- package/src/lib/utils/track-label.ts +36 -0
- package/src/lib/utils/volume-utils.ts +13 -0
- package/build/components/chrome.d.ts +0 -7
- package/build/components/control-bar.d.ts +0 -6
- package/build/components/overlay.d.ts +0 -4
- package/build/components/playback-slider.d.ts +0 -2
- package/build/components/progress-bar.d.ts +0 -1
- package/build/components/settings.d.ts +0 -2
- package/build/components/sound.d.ts +0 -4
- package/build/components/volume-slider.d.ts +0 -6
- package/build/index.d.ts +0 -26
- package/build/index.js +0 -3416
- package/build/main.d.ts +0 -1
- package/build/state-machines/data-source.d.ts +0 -27
- package/build/state-machines/index.d.ts +0 -34038
- package/build/state-machines/media-properties.d.ts +0 -45
- package/build/state-machines/media-source.d.ts +0 -34
- package/build/state-machines/media.d.ts +0 -8558
- package/build/state-machines/subtitles.d.ts +0 -56
- package/build/state-machines/thumbnails.d.ts +0 -24
- package/build/state-machines/utils.d.ts +0 -26
- package/build/utils/actor-utils.d.ts +0 -2
- package/build/utils/context.d.ts +0 -14
- package/build/utils/index.d.ts +0 -4
- package/build/utils/languages.d.ts +0 -260
- package/build/utils/mp4box.d.ts +0 -61
- package/build/utils/use-local-storage.d.ts +0 -3
- package/build/utils/use-scrub.d.ts +0 -11
- package/build/utils/volume-utils.d.ts +0 -17
- package/build/utils/window-height.d.ts +0 -2
- package/src/components/chrome.tsx +0 -95
- package/src/components/overlay.tsx +0 -91
- package/src/components/settings.tsx +0 -322
- package/src/components/sound.tsx +0 -101
- package/src/index.tsx +0 -195
- package/src/main.tsx +0 -169
- package/src/state-machines/data-source.ts +0 -84
- package/src/state-machines/index.ts +0 -5
- package/src/state-machines/media-properties.ts +0 -82
- package/src/state-machines/media-source.ts +0 -129
- package/src/state-machines/media.ts +0 -255
- package/src/state-machines/subtitles.ts +0 -285
- package/src/state-machines/thumbnails.ts +0 -123
- package/src/state-machines/utils.ts +0 -94
- package/src/utils/actor-utils.ts +0 -19
- package/src/utils/context.ts +0 -23
- package/src/utils/index.ts +0 -229
- package/src/utils/languages.ts +0 -262
- package/src/utils/mp4box.ts +0 -74
- package/src/utils/use-local-storage.ts +0 -30
- package/src/utils/use-scrub.ts +0 -40
- package/src/utils/volume-utils.ts +0 -39
- package/src/utils/window-height.ts +0 -19
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -28
- package/tsconfig.node.json +0 -9
- /package/{build → dist}/utils/colors.d.ts +0 -0
- /package/{build → dist}/utils/fonts.d.ts +0 -0
- /package/{build → dist}/utils/time.d.ts +0 -0
- /package/src/{assets → lib/assets}/picture-in-picture.svg +0 -0
- /package/src/{utils → lib/utils}/colors.ts +0 -0
- /package/src/{utils → lib/utils}/fonts.ts +0 -0
- /package/src/{utils → lib/utils}/time.ts +0 -0
|
@@ -1,56 +0,0 @@
|
|
|
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: 'TIME_UPDATE';
|
|
15
|
-
currentTime: number;
|
|
16
|
-
};
|
|
17
|
-
type SubtitlesEmittedEvents = {
|
|
18
|
-
type: 'WAITING';
|
|
19
|
-
} | {
|
|
20
|
-
type: 'SUBTITLE_STREAMS_UPDATED';
|
|
21
|
-
subtitlesStreams: SubtitleStream[];
|
|
22
|
-
} | {
|
|
23
|
-
type: 'SELECTED_SUBTITLE_STREAM_UPDATED';
|
|
24
|
-
streamIndex: number;
|
|
25
|
-
};
|
|
26
|
-
type SubtitlesInput = {
|
|
27
|
-
publicPath: string;
|
|
28
|
-
videoElement: HTMLVideoElement;
|
|
29
|
-
canvasElement: HTMLCanvasElement;
|
|
30
|
-
subtitlesRendererOptions: Omit<JassubOptions, 'video' | 'canvas'>;
|
|
31
|
-
};
|
|
32
|
-
export type SubtitlePart = {
|
|
33
|
-
type: 'header';
|
|
34
|
-
streamIndex: number;
|
|
35
|
-
content: string;
|
|
36
|
-
eventsContent: string;
|
|
37
|
-
dialogueFormatContent: string;
|
|
38
|
-
parsed: ParsedASS;
|
|
39
|
-
} | {
|
|
40
|
-
type: 'dialogue';
|
|
41
|
-
streamIndex: number;
|
|
42
|
-
index: number;
|
|
43
|
-
content: string;
|
|
44
|
-
parsed: ParsedASS;
|
|
45
|
-
assEvent: ASS_Event;
|
|
46
|
-
};
|
|
47
|
-
export type SubtitleStream = {
|
|
48
|
-
header: SubtitlePart & {
|
|
49
|
-
type: 'header';
|
|
50
|
-
};
|
|
51
|
-
dialogues: (SubtitlePart & {
|
|
52
|
-
type: 'dialogue';
|
|
53
|
-
})[];
|
|
54
|
-
};
|
|
55
|
-
declare const _default: import("xstate").CallbackActorLogic<SubtitlesEvents, SubtitlesInput, SubtitlesEmittedEvents>;
|
|
56
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,26 +0,0 @@
|
|
|
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 {};
|
package/build/utils/context.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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>;
|
package/build/utils/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
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>>;
|
|
@@ -1,260 +0,0 @@
|
|
|
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 {};
|
package/build/utils/mp4box.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/// <reference types="@emotion/react/types/css-prop" />
|
|
2
|
-
import { MouseEventHandler, ReactNode, useContext, useRef, type HTMLAttributes } from 'react'
|
|
3
|
-
|
|
4
|
-
import { css } from '@emotion/react'
|
|
5
|
-
|
|
6
|
-
import { MediaMachineContext } from '../state-machines'
|
|
7
|
-
import { MediaPlayerContext } from '../utils/context'
|
|
8
|
-
import { togglePlay } from '../utils/actor-utils'
|
|
9
|
-
import { Overlay } from './overlay'
|
|
10
|
-
import ControlBar from './control-bar'
|
|
11
|
-
|
|
12
|
-
const style = css`
|
|
13
|
-
position: relative;
|
|
14
|
-
background-color: black;
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
height: 100%;
|
|
19
|
-
width: 100%;
|
|
20
|
-
|
|
21
|
-
& > div:not(:last-of-type) {
|
|
22
|
-
position: absolute;
|
|
23
|
-
z-index: 2;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
canvas {
|
|
27
|
-
height: 100%;
|
|
28
|
-
width: 100%;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
position: absolute;
|
|
31
|
-
z-index: 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.video, video {
|
|
35
|
-
height: 100%;
|
|
36
|
-
width: 100%;
|
|
37
|
-
background-color: black;
|
|
38
|
-
object-fit: contain;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.hide {
|
|
42
|
-
cursor: none;
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
export type ChromeOptions = {
|
|
47
|
-
mediaInformation?: ReactNode
|
|
48
|
-
loadingInformation?: ReactNode
|
|
49
|
-
} & HTMLAttributes<HTMLDivElement>
|
|
50
|
-
|
|
51
|
-
export const Chrome = ({ children, mediaInformation, loadingInformation }: ChromeOptions) => {
|
|
52
|
-
const mediaActor = MediaMachineContext.useActorRef()
|
|
53
|
-
const mediaPlayerContext = useContext(MediaPlayerContext)
|
|
54
|
-
const isPaused = MediaMachineContext.useSelector((state) => state.context.media.paused)
|
|
55
|
-
const currentTime = MediaMachineContext.useSelector((state) => state.context.media.currentTime)
|
|
56
|
-
const duration = MediaMachineContext.useSelector((state) => state.context.media.duration)
|
|
57
|
-
|
|
58
|
-
const autoHide = useRef<number>()
|
|
59
|
-
const containerRef = useRef<HTMLDivElement>(null)
|
|
60
|
-
|
|
61
|
-
const mouseMove: MouseEventHandler<HTMLDivElement> = (ev) => {
|
|
62
|
-
mediaPlayerContext.update(({ ...mediaPlayerContext, hideUI: false }))
|
|
63
|
-
if (autoHide.current) clearInterval(autoHide.current)
|
|
64
|
-
const timeout = setTimeout(() => {
|
|
65
|
-
mediaPlayerContext.update(({ ...mediaPlayerContext, hideUI: true }))
|
|
66
|
-
}, 3_000) as unknown as number
|
|
67
|
-
autoHide.current = timeout
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const mouseOut: React.DOMAttributes<HTMLDivElement>['onMouseOut'] = (ev) => {
|
|
71
|
-
if (ev.currentTarget.parentElement !== ev.relatedTarget && ev.relatedTarget !== null) return
|
|
72
|
-
mediaPlayerContext.update(({ ...mediaPlayerContext, hideUI: true }))
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<div
|
|
77
|
-
css={style}
|
|
78
|
-
ref={containerRef}
|
|
79
|
-
onMouseMove={mouseMove}
|
|
80
|
-
onMouseOut={mouseOut}
|
|
81
|
-
className={mediaPlayerContext.hideUI ? 'hide' : ''}
|
|
82
|
-
>
|
|
83
|
-
<Overlay loadingInformation={loadingInformation}/>
|
|
84
|
-
<ControlBar mediaInformation={mediaInformation} containerRef={containerRef}/>
|
|
85
|
-
<div
|
|
86
|
-
className='video'
|
|
87
|
-
onClick={() => togglePlay(mediaActor, isPaused, duration, currentTime)}
|
|
88
|
-
>
|
|
89
|
-
{children}
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export default Chrome
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/// <reference types="@emotion/react/types/css-prop" />
|
|
2
|
-
|
|
3
|
-
import { ClassAttributes, ReactNode, useCallback, useContext, useEffect, useState } from 'react'
|
|
4
|
-
import { css } from '@emotion/react'
|
|
5
|
-
|
|
6
|
-
import { MediaMachineContext } from '../state-machines'
|
|
7
|
-
import { MediaPlayerContext } from '../utils/context'
|
|
8
|
-
import { fonts } from '../utils/fonts'
|
|
9
|
-
|
|
10
|
-
const style = css`
|
|
11
|
-
top: unset !important;
|
|
12
|
-
left: unset !important;
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
margin: auto;
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
const titleStyle = css`
|
|
20
|
-
position: absolute;
|
|
21
|
-
top: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
width: 100%;
|
|
24
|
-
padding: 2.4rem;
|
|
25
|
-
${fonts.headings.small}
|
|
26
|
-
color: white;
|
|
27
|
-
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
28
|
-
z-index: 2;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
|
|
31
|
-
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
32
|
-
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
const loadingInformationStyle = css`
|
|
36
|
-
position: absolute;
|
|
37
|
-
top: 0;
|
|
38
|
-
left: 0;
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
font-size: 2rem;
|
|
42
|
-
color: white;
|
|
43
|
-
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
44
|
-
z-index: 2;
|
|
45
|
-
display: flex;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
align-items: center;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
export const Overlay = ({ loadingInformation }: { loadingInformation?: ReactNode }) => {
|
|
52
|
-
const mediaActor = MediaMachineContext.useActorRef()
|
|
53
|
-
const duration = MediaMachineContext.useSelector((state) => state.context.media.duration)
|
|
54
|
-
const mediaPlayerContext = useContext(MediaPlayerContext)
|
|
55
|
-
|
|
56
|
-
const [canvasElement, setCanvasElement] = useState<HTMLCanvasElement | null>()
|
|
57
|
-
const refFunction: ClassAttributes<HTMLCanvasElement>['ref'] = useCallback((element: HTMLCanvasElement | null) => {
|
|
58
|
-
setCanvasElement(element)
|
|
59
|
-
}, [])
|
|
60
|
-
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!canvasElement) return
|
|
63
|
-
mediaActor.send({
|
|
64
|
-
type: 'SET_CANVAS_ELEMENT',
|
|
65
|
-
canvasElement,
|
|
66
|
-
})
|
|
67
|
-
}, [canvasElement])
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<>
|
|
71
|
-
{
|
|
72
|
-
mediaPlayerContext.title
|
|
73
|
-
? (
|
|
74
|
-
<div
|
|
75
|
-
css={titleStyle}
|
|
76
|
-
style={{ ...mediaPlayerContext.hideUI ? { opacity: '0', pointerEvents: 'none' } : {} }}
|
|
77
|
-
>
|
|
78
|
-
{mediaPlayerContext.title}
|
|
79
|
-
</div>
|
|
80
|
-
)
|
|
81
|
-
: undefined
|
|
82
|
-
}
|
|
83
|
-
{
|
|
84
|
-
duration === undefined && loadingInformation
|
|
85
|
-
? <div css={loadingInformationStyle}>{loadingInformation}</div>
|
|
86
|
-
: undefined
|
|
87
|
-
}
|
|
88
|
-
<canvas ref={refFunction} css={style}/>
|
|
89
|
-
</>
|
|
90
|
-
)
|
|
91
|
-
}
|