react-native-video-provider 0.1.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.
- package/AuVideo.podspec +28 -0
- package/LICENSE +20 -0
- package/README.md +183 -0
- package/android/build.gradle +59 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/auvideo/AuVideoModule.kt +259 -0
- package/android/src/main/java/com/auvideo/AuVideoPackage.kt +35 -0
- package/android/src/main/java/com/auvideo/AuVideoSurfaceView.kt +40 -0
- package/android/src/main/java/com/auvideo/AuVideoSurfaceViewManager.kt +38 -0
- package/android/src/main/java/com/auvideo/PlayerCore.kt +366 -0
- package/android/src/main/java/com/auvideo/SurfaceRegistry.kt +26 -0
- package/android/src/main/res/layout/au_video_player_view.xml +10 -0
- package/ios/AuVideo.h +10 -0
- package/ios/AuVideo.mm +232 -0
- package/ios/AuVideoOrientation.swift +59 -0
- package/ios/AuVideoPlayerCore.swift +415 -0
- package/ios/AuVideoSurfaceRegistry.swift +30 -0
- package/ios/AuVideoSurfaceView.h +15 -0
- package/ios/AuVideoSurfaceView.mm +63 -0
- package/lib/module/AuVideoSurfaceNativeComponent.ts +8 -0
- package/lib/module/NativeAuVideo.js +5 -0
- package/lib/module/NativeAuVideo.js.map +1 -0
- package/lib/module/components/FloatingPlayer.js +119 -0
- package/lib/module/components/FloatingPlayer.js.map +1 -0
- package/lib/module/components/FullscreenPlayer.js +59 -0
- package/lib/module/components/FullscreenPlayer.js.map +1 -0
- package/lib/module/components/GestureOverlay.js +56 -0
- package/lib/module/components/GestureOverlay.js.map +1 -0
- package/lib/module/components/MiniPlayer.js +89 -0
- package/lib/module/components/MiniPlayer.js.map +1 -0
- package/lib/module/components/VideoControls.js +191 -0
- package/lib/module/components/VideoControls.js.map +1 -0
- package/lib/module/components/VideoPlayer.js +65 -0
- package/lib/module/components/VideoPlayer.js.map +1 -0
- package/lib/module/components/VideoSurface.js +35 -0
- package/lib/module/components/VideoSurface.js.map +1 -0
- package/lib/module/core/VideoManager.js +436 -0
- package/lib/module/core/VideoManager.js.map +1 -0
- package/lib/module/hooks/useFullscreen.js +19 -0
- package/lib/module/hooks/useFullscreen.js.map +1 -0
- package/lib/module/hooks/usePiP.js +17 -0
- package/lib/module/hooks/usePiP.js.map +1 -0
- package/lib/module/hooks/usePlayback.js +21 -0
- package/lib/module/hooks/usePlayback.js.map +1 -0
- package/lib/module/hooks/useVideo.js +17 -0
- package/lib/module/hooks/useVideo.js.map +1 -0
- package/lib/module/hooks/useVideoEvents.js +26 -0
- package/lib/module/hooks/useVideoEvents.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/provider/VideoContext.js +14 -0
- package/lib/module/provider/VideoContext.js.map +1 -0
- package/lib/module/provider/VideoProvider.js +36 -0
- package/lib/module/provider/VideoProvider.js.map +1 -0
- package/lib/module/state/createVideoStore.js +33 -0
- package/lib/module/state/createVideoStore.js.map +1 -0
- package/lib/module/types/events.js +4 -0
- package/lib/module/types/events.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/video.js +2 -0
- package/lib/module/types/video.js.map +1 -0
- package/lib/module/utils/Emitter.js +39 -0
- package/lib/module/utils/Emitter.js.map +1 -0
- package/lib/module/utils/formatTime.js +15 -0
- package/lib/module/utils/formatTime.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AuVideoSurfaceNativeComponent.d.ts +8 -0
- package/lib/typescript/src/AuVideoSurfaceNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/NativeAuVideo.d.ts +85 -0
- package/lib/typescript/src/NativeAuVideo.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatingPlayer.d.ts +12 -0
- package/lib/typescript/src/components/FloatingPlayer.d.ts.map +1 -0
- package/lib/typescript/src/components/FullscreenPlayer.d.ts +12 -0
- package/lib/typescript/src/components/FullscreenPlayer.d.ts.map +1 -0
- package/lib/typescript/src/components/GestureOverlay.d.ts +14 -0
- package/lib/typescript/src/components/GestureOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/MiniPlayer.d.ts +16 -0
- package/lib/typescript/src/components/MiniPlayer.d.ts.map +1 -0
- package/lib/typescript/src/components/VideoControls.d.ts +17 -0
- package/lib/typescript/src/components/VideoControls.d.ts.map +1 -0
- package/lib/typescript/src/components/VideoPlayer.d.ts +27 -0
- package/lib/typescript/src/components/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/components/VideoSurface.d.ts +18 -0
- package/lib/typescript/src/components/VideoSurface.d.ts.map +1 -0
- package/lib/typescript/src/core/VideoManager.d.ts +88 -0
- package/lib/typescript/src/core/VideoManager.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useFullscreen.d.ts +7 -0
- package/lib/typescript/src/hooks/useFullscreen.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePiP.d.ts +6 -0
- package/lib/typescript/src/hooks/usePiP.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePlayback.d.ts +13 -0
- package/lib/typescript/src/hooks/usePlayback.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVideo.d.ts +13 -0
- package/lib/typescript/src/hooks/useVideo.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVideoEvents.d.ts +14 -0
- package/lib/typescript/src/hooks/useVideoEvents.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +18 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/provider/VideoContext.d.ts +8 -0
- package/lib/typescript/src/provider/VideoContext.d.ts.map +1 -0
- package/lib/typescript/src/provider/VideoProvider.d.ts +18 -0
- package/lib/typescript/src/provider/VideoProvider.d.ts.map +1 -0
- package/lib/typescript/src/state/createVideoStore.d.ts +6 -0
- package/lib/typescript/src/state/createVideoStore.d.ts.map +1 -0
- package/lib/typescript/src/types/events.d.ts +46 -0
- package/lib/typescript/src/types/events.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +3 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/video.d.ts +70 -0
- package/lib/typescript/src/types/video.d.ts.map +1 -0
- package/lib/typescript/src/utils/Emitter.d.ts +15 -0
- package/lib/typescript/src/utils/Emitter.d.ts.map +1 -0
- package/lib/typescript/src/utils/formatTime.d.ts +2 -0
- package/lib/typescript/src/utils/formatTime.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/AuVideoSurfaceNativeComponent.ts +8 -0
- package/src/NativeAuVideo.ts +106 -0
- package/src/components/FloatingPlayer.tsx +130 -0
- package/src/components/FullscreenPlayer.tsx +64 -0
- package/src/components/GestureOverlay.tsx +76 -0
- package/src/components/MiniPlayer.tsx +93 -0
- package/src/components/VideoControls.tsx +213 -0
- package/src/components/VideoPlayer.tsx +77 -0
- package/src/components/VideoSurface.tsx +39 -0
- package/src/core/VideoManager.ts +441 -0
- package/src/hooks/useFullscreen.ts +14 -0
- package/src/hooks/usePiP.ts +13 -0
- package/src/hooks/usePlayback.ts +26 -0
- package/src/hooks/useVideo.ts +16 -0
- package/src/hooks/useVideoEvents.ts +33 -0
- package/src/index.ts +54 -0
- package/src/provider/VideoContext.ts +12 -0
- package/src/provider/VideoProvider.tsx +41 -0
- package/src/state/createVideoStore.ts +33 -0
- package/src/types/events.ts +22 -0
- package/src/types/index.ts +11 -0
- package/src/types/video.ts +85 -0
- package/src/utils/Emitter.ts +51 -0
- package/src/utils/formatTime.ts +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","VideoManager","VideoContext","FullscreenPlayer","FloatingPlayer","jsx","_jsx","jsxs","_jsxs","VideoProvider","children","config","manager","shared","init","cfg","providerConfig","Provider","value","floatingHost","fullscreenHost"],"sourceRoot":"../../../src","sources":["provider/VideoProvider.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAgC,OAAO;AAClE,SAASC,YAAY,QAAQ,yBAAsB;AAEnD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,mCAAgC;AACjE,SAASC,cAAc,QAAQ,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAM9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAC;EAAEC,QAAQ;EAAEC;AAA2B,CAAC,EAAE;EACtE,MAAMC,OAAO,GAAGZ,OAAO,CAAC,MAAMC,YAAY,CAACY,MAAM,EAAE,EAAE,CAAC;EAEtDd,SAAS,CAAC,MAAM;IACda,OAAO,CAACE,IAAI,CAACH,MAAM,CAAC;IACpB;IACA;EACF,CAAC,EAAE,CAACC,OAAO,EAAED,MAAM,CAAC,CAAC;EAErB,MAAMI,GAAG,GAAGH,OAAO,CAACI,cAAc;EAElC,oBACER,KAAA,CAACN,YAAY,CAACe,QAAQ;IAACC,KAAK,EAAEN,OAAQ;IAAAF,QAAA,GACnCA,QAAQ,EACRK,GAAG,CAACI,YAAY,KAAK,KAAK,gBAAGb,IAAA,CAACF,cAAc,IAAE,CAAC,GAAG,IAAI,EACtDW,GAAG,CAACK,cAAc,KAAK,KAAK,gBAAGd,IAAA,CAACH,gBAAgB,IAAE,CAAC,GAAG,IAAI;EAAA,CACtC,CAAC;AAE5B","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createStore } from 'zustand/vanilla';
|
|
4
|
+
export const initialVideoState = {
|
|
5
|
+
currentVideo: null,
|
|
6
|
+
status: 'idle',
|
|
7
|
+
playing: false,
|
|
8
|
+
paused: false,
|
|
9
|
+
buffering: false,
|
|
10
|
+
loading: false,
|
|
11
|
+
position: 0,
|
|
12
|
+
duration: 0,
|
|
13
|
+
buffered: 0,
|
|
14
|
+
rate: 1,
|
|
15
|
+
volume: 1,
|
|
16
|
+
muted: false,
|
|
17
|
+
repeat: false,
|
|
18
|
+
resizeMode: 'contain',
|
|
19
|
+
fullscreen: false,
|
|
20
|
+
pip: false,
|
|
21
|
+
floating: false,
|
|
22
|
+
mode: 'hidden',
|
|
23
|
+
surfaceId: null,
|
|
24
|
+
videoWidth: 0,
|
|
25
|
+
videoHeight: 0,
|
|
26
|
+
error: null
|
|
27
|
+
};
|
|
28
|
+
export function createVideoStore() {
|
|
29
|
+
return createStore()(() => ({
|
|
30
|
+
...initialVideoState
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=createVideoStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStore","initialVideoState","currentVideo","status","playing","paused","buffering","loading","position","duration","buffered","rate","volume","muted","repeat","resizeMode","fullscreen","pip","floating","mode","surfaceId","videoWidth","videoHeight","error","createVideoStore"],"sourceRoot":"../../../src","sources":["state/createVideoStore.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAuB,iBAAiB;AAG5D,OAAO,MAAMC,iBAA6B,GAAG;EAC3CC,YAAY,EAAE,IAAI;EAClBC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAE,KAAK;EACdC,MAAM,EAAE,KAAK;EACbC,SAAS,EAAE,KAAK;EAChBC,OAAO,EAAE,KAAK;EACdC,QAAQ,EAAE,CAAC;EACXC,QAAQ,EAAE,CAAC;EACXC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,KAAK;EACZC,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,SAAS;EACrBC,UAAU,EAAE,KAAK;EACjBC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,KAAK;EACfC,IAAI,EAAE,QAAQ;EACdC,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE,CAAC;EACbC,WAAW,EAAE,CAAC;EACdC,KAAK,EAAE;AACT,CAAC;AAID,OAAO,SAASC,gBAAgBA,CAAA,EAAe;EAC7C,OAAOxB,WAAW,CAAa,CAAC,CAAC,OAAO;IAAE,GAAGC;EAAkB,CAAC,CAAC,CAAC;AACpE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/events.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/video.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minimal typed event emitter. Listener errors are isolated so one broken
|
|
5
|
+
* subscriber cannot break playback state propagation.
|
|
6
|
+
*/
|
|
7
|
+
export class Emitter {
|
|
8
|
+
listeners = new Map();
|
|
9
|
+
addListener(event, listener) {
|
|
10
|
+
let set = this.listeners.get(event);
|
|
11
|
+
if (!set) {
|
|
12
|
+
set = new Set();
|
|
13
|
+
this.listeners.set(event, set);
|
|
14
|
+
}
|
|
15
|
+
set.add(listener);
|
|
16
|
+
return {
|
|
17
|
+
remove: () => {
|
|
18
|
+
set.delete(listener);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
emit(event, payload) {
|
|
23
|
+
const set = this.listeners.get(event);
|
|
24
|
+
if (!set) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const listener of Array.from(set)) {
|
|
28
|
+
try {
|
|
29
|
+
listener(payload);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(`[react-native-video-provider] listener for ${String(event)} threw`, e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
removeAll() {
|
|
36
|
+
this.listeners.clear();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Emitter","listeners","Map","addListener","event","listener","set","get","Set","add","remove","delete","emit","payload","Array","from","e","console","error","String","removeAll","clear"],"sourceRoot":"../../../src","sources":["utils/Emitter.ts"],"mappings":";;AAMA;AACA;AACA;AACA;AACA,OAAO,MAAMA,OAAO,CAAwB;EAClCC,SAAS,GAAG,IAAIC,GAAG,CAAqC,CAAC;EAEjEC,WAAWA,CACTC,KAAQ,EACRC,QAA6B,EACf;IACd,IAAIC,GAAG,GAAG,IAAI,CAACL,SAAS,CAACM,GAAG,CAACH,KAAK,CAAC;IACnC,IAAI,CAACE,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIE,GAAG,CAAC,CAAC;MACf,IAAI,CAACP,SAAS,CAACK,GAAG,CAACF,KAAK,EAAEE,GAAG,CAAC;IAChC;IACAA,GAAG,CAACG,GAAG,CAACJ,QAA2B,CAAC;IACpC,OAAO;MACLK,MAAM,EAAEA,CAAA,KAAM;QACZJ,GAAG,CAACK,MAAM,CAACN,QAA2B,CAAC;MACzC;IACF,CAAC;EACH;EAEAO,IAAIA,CAAyBR,KAAQ,EAAES,OAAkB,EAAQ;IAC/D,MAAMP,GAAG,GAAG,IAAI,CAACL,SAAS,CAACM,GAAG,CAACH,KAAK,CAAC;IACrC,IAAI,CAACE,GAAG,EAAE;MACR;IACF;IACA,KAAK,MAAMD,QAAQ,IAAIS,KAAK,CAACC,IAAI,CAACT,GAAG,CAAC,EAAE;MACtC,IAAI;QACDD,QAAQ,CAAyBQ,OAAO,CAAC;MAC5C,CAAC,CAAC,OAAOG,CAAC,EAAE;QACVC,OAAO,CAACC,KAAK,CACX,8CAA8CC,MAAM,CAACf,KAAK,CAAC,QAAQ,EACnEY,CACF,CAAC;MACH;IACF;EACF;EAEAI,SAASA,CAAA,EAAS;IAChB,IAAI,CAACnB,SAAS,CAACoB,KAAK,CAAC,CAAC;EACxB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function formatTime(totalSeconds) {
|
|
4
|
+
if (!Number.isFinite(totalSeconds) || totalSeconds < 0) {
|
|
5
|
+
return '0:00';
|
|
6
|
+
}
|
|
7
|
+
const s = Math.floor(totalSeconds);
|
|
8
|
+
const hours = Math.floor(s / 3600);
|
|
9
|
+
const minutes = Math.floor(s % 3600 / 60);
|
|
10
|
+
const seconds = s % 60;
|
|
11
|
+
const mm = hours > 0 ? String(minutes).padStart(2, '0') : String(minutes);
|
|
12
|
+
const ss = String(seconds).padStart(2, '0');
|
|
13
|
+
return hours > 0 ? `${hours}:${mm}:${ss}` : `${mm}:${ss}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=formatTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatTime","totalSeconds","Number","isFinite","s","Math","floor","hours","minutes","seconds","mm","String","padStart","ss"],"sourceRoot":"../../../src","sources":["utils/formatTime.ts"],"mappings":";;AAAA,OAAO,SAASA,UAAUA,CAACC,YAAoB,EAAU;EACvD,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,GAAG,CAAC,EAAE;IACtD,OAAO,MAAM;EACf;EACA,MAAMG,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACL,YAAY,CAAC;EAClC,MAAMM,KAAK,GAAGF,IAAI,CAACC,KAAK,CAACF,CAAC,GAAG,IAAI,CAAC;EAClC,MAAMI,OAAO,GAAGH,IAAI,CAACC,KAAK,CAAEF,CAAC,GAAG,IAAI,GAAI,EAAE,CAAC;EAC3C,MAAMK,OAAO,GAAGL,CAAC,GAAG,EAAE;EACtB,MAAMM,EAAE,GAAGH,KAAK,GAAG,CAAC,GAAGI,MAAM,CAACH,OAAO,CAAC,CAACI,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAGD,MAAM,CAACH,OAAO,CAAC;EACzE,MAAMK,EAAE,GAAGF,MAAM,CAACF,OAAO,CAAC,CAACG,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAC3C,OAAOL,KAAK,GAAG,CAAC,GAAG,GAAGA,KAAK,IAAIG,EAAE,IAAIG,EAAE,EAAE,GAAG,GAAGH,EAAE,IAAIG,EAAE,EAAE;AAC3D","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
export interface NativeProps extends ViewProps {
|
|
3
|
+
/** Unique id this surface registers under in the native surface registry. */
|
|
4
|
+
surfaceId: string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=AuVideoSurfaceNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuVideoSurfaceNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/AuVideoSurfaceNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;CACnB;;AAED,wBAAyE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type TurboModule, type CodegenTypes } from 'react-native';
|
|
2
|
+
export type NativeVideoSource = {
|
|
3
|
+
id: string;
|
|
4
|
+
uri: string;
|
|
5
|
+
/** HTTP headers, string -> string */
|
|
6
|
+
headers?: CodegenTypes.UnsafeObject;
|
|
7
|
+
title?: string;
|
|
8
|
+
artist?: string;
|
|
9
|
+
artworkUri?: string;
|
|
10
|
+
/** Seconds. Applied only when the item is (re)loaded. */
|
|
11
|
+
startPosition?: number;
|
|
12
|
+
};
|
|
13
|
+
export type NativeStatusEvent = {
|
|
14
|
+
/** idle | loading | ready | playing | paused | buffering | ended | error */
|
|
15
|
+
status: string;
|
|
16
|
+
};
|
|
17
|
+
export type NativeLoadEvent = {
|
|
18
|
+
videoId: string;
|
|
19
|
+
duration: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
export type NativeProgressEvent = {
|
|
24
|
+
position: number;
|
|
25
|
+
duration: number;
|
|
26
|
+
buffered: number;
|
|
27
|
+
};
|
|
28
|
+
export type NativeSeekEvent = {
|
|
29
|
+
position: number;
|
|
30
|
+
};
|
|
31
|
+
export type NativeErrorEvent = {
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
export type NativeSurfaceEvent = {
|
|
36
|
+
surfaceId: string;
|
|
37
|
+
};
|
|
38
|
+
export type NativePipEvent = {
|
|
39
|
+
active: boolean;
|
|
40
|
+
};
|
|
41
|
+
export interface Spec extends TurboModule {
|
|
42
|
+
/** Idempotent. Creates the singleton native player if needed. */
|
|
43
|
+
nativeInit(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Load a source into the engine. If the currently loaded source has the
|
|
46
|
+
* same `id`, this is a no-op (same-video handoff) and playback continues.
|
|
47
|
+
*/
|
|
48
|
+
setSource(source: NativeVideoSource, autoplay: boolean): void;
|
|
49
|
+
/** Warm a source without rendering or interrupting current playback. */
|
|
50
|
+
preload(source: NativeVideoSource): void;
|
|
51
|
+
play(): void;
|
|
52
|
+
pause(): void;
|
|
53
|
+
stop(): void;
|
|
54
|
+
seekTo(position: number): void;
|
|
55
|
+
setRate(rate: number): void;
|
|
56
|
+
setVolume(volume: number): void;
|
|
57
|
+
setMuted(muted: boolean): void;
|
|
58
|
+
setRepeat(repeat: boolean): void;
|
|
59
|
+
/** contain | cover | stretch */
|
|
60
|
+
setResizeMode(mode: string): void;
|
|
61
|
+
/** Re-parent the player view into the surface registered under this id. */
|
|
62
|
+
attach(surfaceId: string): void;
|
|
63
|
+
detach(): void;
|
|
64
|
+
/** Unlock rotation + immersive mode. Does not move the player. */
|
|
65
|
+
enterFullscreen(): void;
|
|
66
|
+
/** Restore the previous orientation lock. */
|
|
67
|
+
exitFullscreen(): void;
|
|
68
|
+
enterPip(): Promise<boolean>;
|
|
69
|
+
exitPip(): void;
|
|
70
|
+
getPosition(): Promise<number>;
|
|
71
|
+
/** Tear down the native player entirely. */
|
|
72
|
+
releasePlayer(): void;
|
|
73
|
+
readonly onStatusChange: CodegenTypes.EventEmitter<NativeStatusEvent>;
|
|
74
|
+
readonly onLoad: CodegenTypes.EventEmitter<NativeLoadEvent>;
|
|
75
|
+
readonly onProgress: CodegenTypes.EventEmitter<NativeProgressEvent>;
|
|
76
|
+
readonly onSeek: CodegenTypes.EventEmitter<NativeSeekEvent>;
|
|
77
|
+
readonly onEnd: CodegenTypes.EventEmitter<void>;
|
|
78
|
+
readonly onError: CodegenTypes.EventEmitter<NativeErrorEvent>;
|
|
79
|
+
readonly onAttach: CodegenTypes.EventEmitter<NativeSurfaceEvent>;
|
|
80
|
+
readonly onDetach: CodegenTypes.EventEmitter<NativeSurfaceEvent>;
|
|
81
|
+
readonly onPipChange: CodegenTypes.EventEmitter<NativePipEvent>;
|
|
82
|
+
}
|
|
83
|
+
declare const _default: Spec;
|
|
84
|
+
export default _default;
|
|
85
|
+
//# sourceMappingURL=NativeAuVideo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeAuVideo.d.ts","sourceRoot":"","sources":["../../../src/NativeAuVideo.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAq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,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACjE,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;CACjE;;AAED,wBAAiE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FloatingPlayerProps {
|
|
2
|
+
/** Width of the floating window. Default 200. */
|
|
3
|
+
width?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Built-in draggable in-app floating window, rendered by VideoProvider and
|
|
7
|
+
* shown by `showFloating()`. Same engine, same position — expand returns
|
|
8
|
+
* to fullscreen, ✕ hides the window (playback continues; call pause()
|
|
9
|
+
* in onModeChanged if you want otherwise).
|
|
10
|
+
*/
|
|
11
|
+
export declare function FloatingPlayer({ width }: FloatingPlayerProps): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=FloatingPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/FloatingPlayer.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAW,EAAE,EAAE,mBAAmB,sCAiElE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in fullscreen host, rendered by VideoProvider. While visible,
|
|
3
|
+
* rotation is unlocked natively (all orientations allowed); on exit the
|
|
4
|
+
* previous orientation lock is restored and the player re-attaches to the
|
|
5
|
+
* surface it came from.
|
|
6
|
+
*
|
|
7
|
+
* Rendered automatically — you normally never mount this yourself. Apps
|
|
8
|
+
* that want fullscreen "inside" a navigation screen can instead render a
|
|
9
|
+
* plain <VideoSurface> there and call attach().
|
|
10
|
+
*/
|
|
11
|
+
export declare function FullscreenPlayer(): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=FullscreenPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullscreenPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/FullscreenPlayer.tsx"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,uCAoC/B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
export interface GestureOverlayProps extends PropsWithChildren {
|
|
3
|
+
onSingleTap?: () => void;
|
|
4
|
+
onDoubleTapLeft?: () => void;
|
|
5
|
+
onDoubleTapRight?: () => void;
|
|
6
|
+
onLongPress?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Tap layer for player chrome: single tap (toggle controls), double tap
|
|
10
|
+
* left/right (seek back/forward), long press. Pinch/brightness/volume
|
|
11
|
+
* gestures are on the roadmap (need native cooperation).
|
|
12
|
+
*/
|
|
13
|
+
export declare function GestureOverlay({ onSingleTap, onDoubleTapLeft, onDoubleTapRight, onLongPress, children, }: GestureOverlayProps): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=GestureOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GestureOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/GestureOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAQpE,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACT,EAAE,mBAAmB,+BA+CrB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
export interface MiniPlayerProps extends ViewProps {
|
|
3
|
+
/** Surface id. Default "__au_mini__". */
|
|
4
|
+
surfaceId?: string;
|
|
5
|
+
/** Tapping the bar (e.g. navigate back to the detail screen). */
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
/** Called by the ✕ button; button hidden when omitted. */
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Docked mini player bar (Spotify style): thumbnail surface, title,
|
|
12
|
+
* play/pause and close. Attach it with `attach(surfaceId)` — typically when
|
|
13
|
+
* the user leaves the screen that owned playback.
|
|
14
|
+
*/
|
|
15
|
+
export declare function MiniPlayer({ surfaceId, onPress, onClose, style, ...rest }: MiniPlayerProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=MiniPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MiniPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/MiniPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,SAAyB,EACzB,OAAO,EACP,OAAO,EACP,KAAK,EACL,GAAG,IAAI,EACR,EAAE,eAAe,+BA2BjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface VideoControlsProps {
|
|
2
|
+
/** Seconds jumped by double-tap. Default 10. */
|
|
3
|
+
doubleTapSeek?: number;
|
|
4
|
+
/** Auto-hide delay in ms. Default 3000. */
|
|
5
|
+
hideAfter?: number;
|
|
6
|
+
/** Show the fullscreen toggle button. Default true. */
|
|
7
|
+
showFullscreenButton?: boolean;
|
|
8
|
+
/** Called by the close (✕) button; button hidden when omitted. */
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Minimal built-in chrome: play/pause, seek bar, time, mute and fullscreen
|
|
13
|
+
* toggles, with tap-to-show / double-tap-to-seek gestures. Apps wanting a
|
|
14
|
+
* custom design can ignore this and build on usePlayback()/useVideo().
|
|
15
|
+
*/
|
|
16
|
+
export declare function VideoControls({ doubleTapSeek, hideAfter, showFullscreenButton, onClose, }: VideoControlsProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=VideoControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoControls.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoControls.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,aAAkB,EAClB,SAAgB,EAChB,oBAA2B,EAC3B,OAAO,GACR,EAAE,kBAAkB,+BAoHpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import type { ResizeMode, VideoSource } from '../types/video.js';
|
|
3
|
+
export interface VideoPlayerProps extends ViewProps {
|
|
4
|
+
source: VideoSource;
|
|
5
|
+
/** Default true. */
|
|
6
|
+
autoplay?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Surface id to register/attach under. Defaults to `player:<source.id>`,
|
|
9
|
+
* so a feed item and a detail screen showing the same video naturally
|
|
10
|
+
* hand the player off to whichever mounted last.
|
|
11
|
+
*/
|
|
12
|
+
surfaceId?: string;
|
|
13
|
+
/** Show built-in controls. Default true. */
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
resizeMode?: ResizeMode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convenience all-in-one player: `setSource` (same-video handoff aware) +
|
|
19
|
+
* `attach` + surface + optional controls. Rendering two VideoPlayers with
|
|
20
|
+
* the same source id moves the ONE engine — it never creates a second one.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <VideoPlayer source={{ id: '123', uri }} style={{ aspectRatio: 16 / 9 }} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function VideoPlayer({ source, autoplay, surfaceId, controls, resizeMode, style, ...rest }: VideoPlayerProps): import("react").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=VideoPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPlayer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC;AAI9D,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,MAAM,EAAE,WAAW,CAAC;IACpB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAe,EACf,SAAS,EACT,QAAe,EACf,UAAU,EACV,KAAK,EACL,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAuBlB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
export interface VideoSurfaceProps extends ViewProps {
|
|
3
|
+
/** Id this surface registers under. Attach the player with `attach(id)`. */
|
|
4
|
+
surfaceId: string;
|
|
5
|
+
/** Attach the player to this surface as soon as it mounts. Default false. */
|
|
6
|
+
autoAttach?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A dumb rendering surface. It never creates a player — it only marks a
|
|
10
|
+
* spot where the singleton engine can render. Mount as many as you like;
|
|
11
|
+
* the player shows in at most one at a time.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <VideoSurface surfaceId="feed" style={{ aspectRatio: 16 / 9 }} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function VideoSurface({ surfaceId, autoAttach, ...rest }: VideoSurfaceProps): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=VideoSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoSurface.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoSurface.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,UAAkB,EAClB,GAAG,IAAI,EACR,EAAE,iBAAiB,+BAanB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type VideoStore } from '../state/createVideoStore.js';
|
|
2
|
+
import type { VideoEventMap, VideoEventName } from '../types/events.js';
|
|
3
|
+
import type { ResizeMode, SetSourceOptions, VideoProviderConfig, VideoSource } from '../types/video.js';
|
|
4
|
+
import { type Listener, type Subscription } from '../utils/Emitter.js';
|
|
5
|
+
/** Surface id used by the built-in fullscreen host. */
|
|
6
|
+
export declare const FULLSCREEN_SURFACE_ID = "__au_fullscreen__";
|
|
7
|
+
/** Surface id used by the built-in floating host. */
|
|
8
|
+
export declare const FLOATING_SURFACE_ID = "__au_floating__";
|
|
9
|
+
/**
|
|
10
|
+
* The single owner of the native playback engine on the JS side.
|
|
11
|
+
*
|
|
12
|
+
* React components never talk to the native module directly — they issue
|
|
13
|
+
* commands here and subscribe to `store` for state. The manager exists for
|
|
14
|
+
* the whole app lifetime; unmounting React trees never destroys it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class VideoManager {
|
|
17
|
+
private static instance;
|
|
18
|
+
static get shared(): VideoManager;
|
|
19
|
+
readonly store: VideoStore;
|
|
20
|
+
private events;
|
|
21
|
+
private nativeSubscriptions;
|
|
22
|
+
private initialized;
|
|
23
|
+
private config;
|
|
24
|
+
/** Last non-reserved surface, restored after fullscreen/floating exits. */
|
|
25
|
+
private lastInlineSurfaceId;
|
|
26
|
+
private constructor();
|
|
27
|
+
get providerConfig(): Required<VideoProviderConfig>;
|
|
28
|
+
/**
|
|
29
|
+
* Idempotent. Called by VideoProvider on mount ("mount silently"):
|
|
30
|
+
* creates the native player once and wires native events.
|
|
31
|
+
*/
|
|
32
|
+
init(config?: VideoProviderConfig): void;
|
|
33
|
+
addListener<K extends VideoEventName>(event: K, listener: Listener<VideoEventMap[K]>): Subscription;
|
|
34
|
+
private subscribeNative;
|
|
35
|
+
private applyStatus;
|
|
36
|
+
/**
|
|
37
|
+
* Load a video. Same-video handoff: if `source.id` equals the current
|
|
38
|
+
* video's id the engine is untouched — position, buffer and play state
|
|
39
|
+
* survive. Pass `surfaceId` to attach in the same call.
|
|
40
|
+
*/
|
|
41
|
+
setSource(source: VideoSource, options?: SetSourceOptions): void;
|
|
42
|
+
/** Warm a source without rendering or touching current playback. */
|
|
43
|
+
preload(source: VideoSource): void;
|
|
44
|
+
play(): void;
|
|
45
|
+
pause(): void;
|
|
46
|
+
resume(): void;
|
|
47
|
+
toggle(): void;
|
|
48
|
+
stop(): void;
|
|
49
|
+
/** @param position seconds */
|
|
50
|
+
seek(position: number): void;
|
|
51
|
+
seekBy(offset: number): void;
|
|
52
|
+
setRate(rate: number): void;
|
|
53
|
+
setVolume(volume: number): void;
|
|
54
|
+
mute(): void;
|
|
55
|
+
unmute(): void;
|
|
56
|
+
setRepeat(repeat: boolean): void;
|
|
57
|
+
setResizeMode(mode: ResizeMode): void;
|
|
58
|
+
getPosition(): Promise<number>;
|
|
59
|
+
/** Re-parent the player into the surface registered under `surfaceId`. */
|
|
60
|
+
attach(surfaceId: string): void;
|
|
61
|
+
/** Detach from any surface. Playback continues (audio) unless configured otherwise. */
|
|
62
|
+
detach(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Called by VideoSurface on unmount. Only clears JS state when the
|
|
65
|
+
* unmounting surface is the active one; the native registry has already
|
|
66
|
+
* dropped its weak reference.
|
|
67
|
+
*/
|
|
68
|
+
handleSurfaceUnmount(surfaceId: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Show the built-in fullscreen host and unlock device rotation.
|
|
71
|
+
* The host mounts a surface and attaches automatically.
|
|
72
|
+
*/
|
|
73
|
+
enterFullscreen(): void;
|
|
74
|
+
/** Restore the previous orientation lock and re-attach the previous surface. */
|
|
75
|
+
exitFullscreen(): void;
|
|
76
|
+
toggleFullscreen(): void;
|
|
77
|
+
showFloating(): void;
|
|
78
|
+
hideFloating(): void;
|
|
79
|
+
enterPiP(): Promise<boolean>;
|
|
80
|
+
exitPiP(): void;
|
|
81
|
+
private restoreInlineSurface;
|
|
82
|
+
private deriveMode;
|
|
83
|
+
private setMode;
|
|
84
|
+
/** Tear the native player down entirely. Rarely needed. */
|
|
85
|
+
destroy(): void;
|
|
86
|
+
private set;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=VideoManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoManager.d.ts","sourceRoot":"","sources":["../../../../src/core/VideoManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,8BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAiB,CAAC;AACrE,OAAO,KAAK,EAGV,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EAEZ,MAAM,mBAAgB,CAAC;AACxB,OAAO,EAAW,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAkB,CAAC;AAE7E,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAgBrD;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IAEpD,MAAM,KAAK,MAAM,IAAI,YAAY,CAKhC;IAED,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAsB;IAEhD,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAIZ;IACF,2EAA2E;IAC3E,OAAO,CAAC,mBAAmB,CAAuB;IAElD,OAAO;IAEP,IAAI,cAAc,IAAI,QAAQ,CAAC,mBAAmB,CAAC,CAElD;IAED;;;OAGG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI;IAYxC,WAAW,CA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lC,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,OAAO;IASf,2DAA2D;IAC3D,OAAO,IAAI,IAAI;IAYf,OAAO,CAAC,GAAG;CAGZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFullscreen.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useFullscreen.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa;;;;;EAS5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePiP.d.ts","sourceRoot":"","sources":["../../../../src/hooks/usePiP.ts"],"names":[],"mappings":"AAIA,wBAAgB,MAAM;;;;EAQrB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VideoState } from '../types/video.js';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to playback state. Pass a selector so your component only
|
|
4
|
+
* re-renders for the fields it displays:
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const position = usePlayback((s) => s.position);
|
|
8
|
+
* const { playing, duration } = usePlayback((s) => ({ ... }));
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function usePlayback(): VideoState;
|
|
12
|
+
export declare function usePlayback<T>(selector: (state: VideoState) => T): T;
|
|
13
|
+
//# sourceMappingURL=usePlayback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlayback.d.ts","sourceRoot":"","sources":["../../../../src/hooks/usePlayback.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAgB,CAAC;AAIjD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,UAAU,CAAC;AAC1C,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VideoManager } from '../core/VideoManager.js';
|
|
2
|
+
/**
|
|
3
|
+
* Command API for the singleton player:
|
|
4
|
+
* `play, pause, resume, toggle, stop, seek, seekBy, setSource, preload,
|
|
5
|
+
* attach, detach, enterFullscreen, exitFullscreen, showFloating,
|
|
6
|
+
* hideFloating, enterPiP, exitPiP, setRate, setVolume, mute, unmute,
|
|
7
|
+
* setRepeat, setResizeMode, addListener, destroy` — plus `store` for
|
|
8
|
+
* imperative reads (`useVideo().store.getState()`).
|
|
9
|
+
*
|
|
10
|
+
* Commands never cause re-renders; subscribe with `usePlayback()` for state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useVideo(): VideoManager;
|
|
13
|
+
//# sourceMappingURL=useVideo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVideo.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVideo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAsB,CAAC;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,IAAI,YAAY,CAEvC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VideoEventMap, VideoEventName } from '../types/events.js';
|
|
2
|
+
export type VideoEventHandlers = {
|
|
3
|
+
[K in VideoEventName]?: (payload: VideoEventMap[K]) => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Subscribe to player events for the lifetime of the component.
|
|
7
|
+
* Handlers are kept in a ref, so inline functions are fine.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* useVideoEvents({ onEnd: () => next(), onError: (e) => report(e) });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function useVideoEvents(handlers: VideoEventHandlers): void;
|
|
14
|
+
//# sourceMappingURL=useVideoEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVideoEvents.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVideoEvents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAiB,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG;KAC9B,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI;CAC5D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAgBjE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { VideoProvider, type VideoProviderProps, } from './provider/VideoProvider.js';
|
|
2
|
+
export { useVideoManager } from './provider/VideoContext.js';
|
|
3
|
+
export { VideoManager, FULLSCREEN_SURFACE_ID, FLOATING_SURFACE_ID, } from './core/VideoManager.js';
|
|
4
|
+
export { VideoSurface, type VideoSurfaceProps, } from './components/VideoSurface.js';
|
|
5
|
+
export { VideoPlayer, type VideoPlayerProps } from './components/VideoPlayer.js';
|
|
6
|
+
export { FullscreenPlayer } from './components/FullscreenPlayer.js';
|
|
7
|
+
export { FloatingPlayer, type FloatingPlayerProps, } from './components/FloatingPlayer.js';
|
|
8
|
+
export { MiniPlayer, type MiniPlayerProps } from './components/MiniPlayer.js';
|
|
9
|
+
export { VideoControls, type VideoControlsProps, } from './components/VideoControls.js';
|
|
10
|
+
export { GestureOverlay, type GestureOverlayProps, } from './components/GestureOverlay.js';
|
|
11
|
+
export { useVideo } from './hooks/useVideo.js';
|
|
12
|
+
export { usePlayback } from './hooks/usePlayback.js';
|
|
13
|
+
export { useFullscreen } from './hooks/useFullscreen.js';
|
|
14
|
+
export { usePiP } from './hooks/usePiP.js';
|
|
15
|
+
export { useVideoEvents, type VideoEventHandlers, } from './hooks/useVideoEvents.js';
|
|
16
|
+
export { formatTime } from './utils/formatTime.js';
|
|
17
|
+
export type { VideoSource, ResizeMode, PlayerMode, PlaybackStatus, VideoError, VideoState, SetSourceOptions, VideoProviderConfig, VideoEventMap, VideoEventName, } from './types/index.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,6BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,wBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,8BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,6BAA0B,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAA+B,CAAC;AACjE,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,gCAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC3E,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,+BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,gCAA6B,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAgB,CAAC;AACxC,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,GACxB,MAAM,2BAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAoB,CAAC;AAEhD,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,kBAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VideoManager } from '../core/VideoManager.js';
|
|
2
|
+
export declare const VideoContext: import("react").Context<VideoManager | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the app-wide VideoManager. Falls back to the shared singleton so
|
|
5
|
+
* the API also works outside the provider (e.g. headless/background code).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useVideoManager(): VideoManager;
|
|
8
|
+
//# sourceMappingURL=VideoContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoContext.d.ts","sourceRoot":"","sources":["../../../../src/provider/VideoContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAsB,CAAC;AAEpD,eAAO,MAAM,YAAY,8CAA2C,CAAC;AAErE;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAE9C"}
|