@banou/media-player 0.3.0 → 0.4.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 (74) hide show
  1. package/README.md +0 -10
  2. package/build/components/chrome.d.ts +4 -0
  3. package/build/components/control-bar.d.ts +5 -0
  4. package/build/components/overlay.d.ts +1 -0
  5. package/build/components/progress-bar.d.ts +1 -0
  6. package/build/components/settings.d.ts +2 -0
  7. package/build/components/sound.d.ts +4 -0
  8. package/build/components/tooltip-display.d.ts +20 -0
  9. package/build/components/volume-slider.d.ts +6 -0
  10. package/build/index.d.ts +23 -48
  11. package/build/index.js +2576 -2250
  12. package/build/main.d.ts +1 -1
  13. package/build/state-machines/data-source.d.ts +27 -0
  14. package/build/state-machines/index.d.ts +33185 -0
  15. package/build/state-machines/media-properties.d.ts +45 -0
  16. package/build/state-machines/media-source.d.ts +34 -0
  17. package/build/state-machines/media.d.ts +8344 -0
  18. package/build/state-machines/subtitles.d.ts +53 -0
  19. package/build/state-machines/thumbnails.d.ts +24 -0
  20. package/build/state-machines/utils.d.ts +26 -0
  21. package/build/utils/actor-utils.d.ts +2 -0
  22. package/build/utils/colors.d.ts +8 -0
  23. package/build/utils/context.d.ts +14 -0
  24. package/build/utils/fonts.d.ts +28 -0
  25. package/build/{utils.d.ts → utils/index.d.ts} +4 -12
  26. package/build/utils/languages.d.ts +260 -0
  27. package/build/{mp4box.d.ts → utils/mp4box.d.ts} +61 -61
  28. package/build/utils/time.d.ts +2 -0
  29. package/build/utils/use-local-storage.d.ts +3 -0
  30. package/build/{use-scrub.d.ts → utils/use-scrub.d.ts} +11 -11
  31. package/build/utils/volume-utils.d.ts +17 -0
  32. package/build/utils/window-height.d.ts +2 -0
  33. package/package.json +15 -12
  34. package/src/assets/picture-in-picture.svg +5 -0
  35. package/src/components/chrome.tsx +89 -0
  36. package/src/components/control-bar.tsx +330 -0
  37. package/src/components/overlay.tsx +28 -0
  38. package/src/components/progress-bar.tsx +252 -0
  39. package/src/components/settings.tsx +269 -0
  40. package/src/components/sound.tsx +101 -0
  41. package/src/components/tooltip-display.tsx +83 -0
  42. package/src/components/volume-slider.tsx +156 -0
  43. package/src/index.tsx +145 -435
  44. package/src/main.tsx +66 -39
  45. package/src/state-machines/data-source.ts +83 -0
  46. package/src/state-machines/index.ts +5 -0
  47. package/src/state-machines/media-properties.ts +78 -0
  48. package/src/state-machines/media-source.ts +129 -0
  49. package/src/state-machines/media.ts +245 -0
  50. package/src/state-machines/subtitles.ts +247 -0
  51. package/src/state-machines/thumbnails.ts +123 -0
  52. package/src/state-machines/utils.ts +94 -0
  53. package/src/utils/actor-utils.ts +19 -0
  54. package/src/utils/colors.ts +9 -0
  55. package/src/utils/context.ts +23 -0
  56. package/src/utils/fonts.ts +156 -0
  57. package/src/{utils.ts → utils/index.ts} +2 -26
  58. package/src/utils/time.ts +16 -0
  59. package/src/utils/use-local-storage.ts +30 -0
  60. package/src/utils/volume-utils.ts +39 -0
  61. package/src/utils/window-height.ts +19 -0
  62. package/tsconfig.json +4 -2
  63. package/build/chrome/bottom.d.ts +0 -22
  64. package/build/chrome/index.d.ts +0 -28
  65. package/build/chrome/overlay.d.ts +0 -9
  66. package/build/languages.d.ts +0 -260
  67. package/build/use-local-storage.d.ts +0 -6
  68. package/src/chrome/bottom.tsx +0 -697
  69. package/src/chrome/index.tsx +0 -203
  70. package/src/chrome/overlay.tsx +0 -104
  71. package/src/use-local-storage.ts +0 -32
  72. /package/src/{languages.ts → utils/languages.ts} +0 -0
  73. /package/src/{mp4box.ts → utils/mp4box.ts} +0 -0
  74. /package/src/{use-scrub.ts → utils/use-scrub.ts} +0 -0
package/README.md CHANGED
@@ -1,13 +1,3 @@
1
1
  ## Media Player
2
2
 
3
3
  A player that somehow manages to playback MKV files
4
-
5
- # Things to fix
6
- - Everytime a new text starts being rendered by libass-wasm (JavascriptSubtitlesOctopus), we might drop a few video frames?
7
- - might wanna use https://www.radix-ui.com/
8
- - PRETTY IMPORTANT The player randomly stops working completly after a normal seek, no errors thrown, just happens after a seek, check it out
9
- - https://9u526jgufnpw9yo6aerstjtvkh31xm.sdbx.app/watch/anilist:140596,mal:50197/mal:50197-1/nyaa:1621740 has subtitles that switch from time to time, subtitle index is kept but array items change indexes
10
-
11
- Todo: make the UI composable components, useable without the actual video player, useful for custom UI embedding on top of players like youtube, ect...
12
-
13
- Take inspiration from https://github.com/cookpete/react-player
@@ -0,0 +1,4 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ export type ChromeOptions = {} & HTMLAttributes<HTMLDivElement>;
3
+ export declare const Chrome: ({ children }: ChromeOptions) => import("react/jsx-runtime").JSX.Element;
4
+ export default Chrome;
@@ -0,0 +1,5 @@
1
+ import { RefObject } from 'react';
2
+ export declare const ControlBar: ({ containerRef }: {
3
+ containerRef: RefObject<HTMLDivElement>;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default ControlBar;
@@ -0,0 +1 @@
1
+ export declare const Overlay: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ProgressBar: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ declare const SettingsAction: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SettingsAction;
@@ -0,0 +1,4 @@
1
+ declare const Sound: ({ ref }: {
2
+ ref: any;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default Sound;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { PlacesType } from 'react-tooltip';
3
+ interface TooltipDisplayProps {
4
+ id: string;
5
+ toolTipText: ReactNode;
6
+ text: ReactNode;
7
+ delayShow?: number;
8
+ closeDelay?: number;
9
+ offset?: number;
10
+ tooltipPlace?: PlacesType;
11
+ size?: buttonSize;
12
+ disabled?: boolean;
13
+ }
14
+ export declare enum buttonSize {
15
+ sm = "sm",
16
+ md = "md",
17
+ lg = "lg"
18
+ }
19
+ export declare const TooltipDisplay: ({ id, toolTipText, text, delayShow, closeDelay, offset, tooltipPlace, disabled, size }: TooltipDisplayProps) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,6 @@
1
+ type VolumeSliderType = {
2
+ value: number;
3
+ onChange: (v: number) => void;
4
+ };
5
+ declare const VolumeSlider: ({ value, onChange }: VolumeSliderType) => import("react/jsx-runtime").JSX.Element;
6
+ export default VolumeSlider;
package/build/index.d.ts CHANGED
@@ -1,48 +1,23 @@
1
- import type { ReactNode, VideoHTMLAttributes } from 'react';
2
- import { makeRemuxer as libavMakeRemuxer } from 'libav-wasm';
3
- export type TransmuxError = {
4
- critical: boolean;
5
- message: string;
6
- count: number;
7
- };
8
- export type Subtitle = {
9
- title: string;
10
- language: string;
11
- data: string;
12
- };
13
- export type Attachment = {
14
- filename: string;
15
- mimetype: string;
16
- data: Uint8Array;
17
- };
18
- type Chunk = {
19
- offset: number;
20
- buffer: Uint8Array;
21
- pts: number;
22
- duration: number;
23
- pos: number;
24
- };
25
- export type FKNVideoControlOptions = {};
26
- export type FKNVideoControl = (args: FKNVideoControlOptions) => JSX.Element;
27
- export type FKNVideoOptions = {
28
- customOverlay?: ReactNode;
29
- baseBufferSize?: number;
30
- size?: number;
31
- fetch: (offset: number, size: number | undefined) => Promise<Response>;
32
- customControls?: FKNVideoControl[];
33
- publicPath: string;
34
- wasmUrl: string;
35
- libavWorkerUrl: string;
36
- libavWorkerOptions?: WorkerOptions;
37
- libassWorkerUrl: string;
38
- makeTransmuxer?: typeof libavMakeRemuxer;
39
- };
40
- export type HeaderChunk = Chunk & {
41
- buffer: {
42
- buffer: {
43
- fileStart: number;
44
- };
45
- };
46
- };
47
- declare const FKNVideo: import("react").ForwardRefExoticComponent<VideoHTMLAttributes<HTMLInputElement> & FKNVideoOptions & import("react").RefAttributes<HTMLVideoElement>>;
48
- export default FKNVideo;
1
+ import type { MutableRefObject, ReactNode, RefCallback } from 'react';
2
+ import { DownloadedRange } from './utils/context';
3
+ export type FKNVideoOptions = {
4
+ title?: string;
5
+ downloadedRanges?: DownloadedRange[];
6
+ read?: (offset: number, size: number) => Promise<ArrayBuffer>;
7
+ size?: number;
8
+ bufferSize?: number;
9
+ publicPath: string;
10
+ jassubWorkerUrl: string;
11
+ jassubWasmUrl: string;
12
+ jassubModernWasmUrl: string;
13
+ libavWorkerUrl: string;
14
+ };
15
+ export declare const FKNVideoRoot: ({ options, videoElement, children }: {
16
+ options: FKNVideoOptions;
17
+ videoElement: HTMLVideoElement | undefined;
18
+ children: ReactNode;
19
+ }) => import("react/jsx-runtime").JSX.Element;
20
+ declare const FKNVideo: ({ ref, ...options }: FKNVideoOptions & {
21
+ ref?: RefCallback<HTMLVideoElement> | MutableRefObject<HTMLVideoElement | null>;
22
+ }) => import("react/jsx-runtime").JSX.Element;
23
+ export default FKNVideo;