From a72ab331dcec9a54b3a4f027413dd1ac3979035c Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 30 Jun 2024 09:38:10 +0000 Subject: [PATCH] Move video ref type to its own file --- src/Video.tsx | 3 +-- src/index.ts | 1 - src/specs/NativeVideoManager.ts | 5 +---- src/types/index.ts | 1 + src/types/video-ref.ts | 18 ++++++++++++++++++ 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/types/video-ref.ts diff --git a/src/Video.tsx b/src/Video.tsx index f2f91f3b..b88aecbc 100644 --- a/src/Video.tsx +++ b/src/Video.tsx @@ -37,8 +37,7 @@ import { resolveAssetSourceForVideo, } from './utils'; import NativeVideoManager from './specs/NativeVideoManager'; -import type {VideoSaveData} from './specs/NativeVideoManager'; -import {ViewType} from './types'; +import {ViewType, type VideoSaveData} from './types'; import type { OnLoadData, OnTextTracksData, diff --git a/src/index.ts b/src/index.ts index b555b80f..3dc7b7bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ import Video from './Video'; export {VideoDecoderProperties} from './VideoDecoderProperties'; export type * from './types'; -export type {VideoRef} from './Video'; export default Video; diff --git a/src/specs/NativeVideoManager.ts b/src/specs/NativeVideoManager.ts index 9472d453..e508ac7f 100644 --- a/src/specs/NativeVideoManager.ts +++ b/src/specs/NativeVideoManager.ts @@ -4,10 +4,7 @@ import type { Float, UnsafeObject, } from 'react-native/Libraries/Types/CodegenTypes'; - -export type VideoSaveData = { - uri: string; -}; +import type {VideoSaveData} from '../types/video-ref'; // @TODO rename to "Spec" when applying new arch export interface VideoManagerType { diff --git a/src/types/index.ts b/src/types/index.ts index ab7cf42d..24725b6c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -7,4 +7,5 @@ export {default as ResizeMode} from './ResizeMode'; export {default as TextTrackType} from './TextTrackType'; export {default as ViewType} from './ViewType'; export * from './video'; +export * from './video-ref'; export * from '../specs/VideoNativeComponent'; diff --git a/src/types/video-ref.ts b/src/types/video-ref.ts new file mode 100644 index 00000000..aeadc7d6 --- /dev/null +++ b/src/types/video-ref.ts @@ -0,0 +1,18 @@ +export type VideoSaveData = { + uri: string; +}; + +export interface VideoRef { + seek: (time: number, tolerance?: number) => void; + resume: () => void; + pause: () => void; + presentFullscreenPlayer: () => void; + dismissFullscreenPlayer: () => void; + restoreUserInterfaceForPictureInPictureStopCompleted: ( + restore: boolean, + ) => void; + save: (options: object) => Promise; + setVolume: (volume: number) => void; + getCurrentPosition: () => Promise; + setFullScreen: (fullScreen: boolean) => void; +}