diff --git a/CHANGELOG.md b/CHANGELOG.md index ee341c38..5870c0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -371,4 +371,4 @@ - Add cookie support for ExoPlayer [#922](https://github.com/react-native-community/react-native-video/pull/922) - Remove ExoPlayer onMetadata that wasn't being used [#1040](https://github.com/react-native-community/react-native-video/pull/1040) - Fix bug where setting the progress interval on iOS didn't work [#800](https://github.com/react-native-community/react-native-video/pull/800) -- Support setting the poster resize mode [#595](https://github.com/react-native-community/react-native-video/pull/595) \ No newline at end of file +- Support setting the poster resize mode [#595](https://github.com/react-native-community/react-native-video/pull/595) diff --git a/src/types/video.ts b/src/types/video.ts index e3b03bc0..013ba245 100644 --- a/src/types/video.ts +++ b/src/types/video.ts @@ -6,7 +6,7 @@ import type FilterType from './FilterType'; export type Headers = Record; -export type ReactVideoSource = Readonly<{ +export type ReactVideoSourceProperties = { uri?: string; isNetwork?: boolean; isAsset?: boolean; @@ -21,7 +21,11 @@ export type ReactVideoSource = Readonly<{ subtitle?: string; description?: string; customImageUri?: string; -}>; +}; + +export type ReactVideoSource = Readonly< + ReactVideoSourceProperties | NodeRequire +>; export type DebugConfig = Readonly<{ enable?: boolean; diff --git a/src/utils.ts b/src/utils.ts index 84beb7d3..9af9c67b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,17 +1,19 @@ import type {Component, RefObject, ComponentClass} from 'react'; import {Image, findNodeHandle} from 'react-native'; import type {ImageSourcePropType} from 'react-native'; -import type {ReactVideoSource} from './types/video'; +import type {ReactVideoSource, ReactVideoSourceProperties} from './types/video'; type Source = ImageSourcePropType | ReactVideoSource; -export function resolveAssetSourceForVideo(source: Source): ReactVideoSource { +export function resolveAssetSourceForVideo( + source: Source, +): ReactVideoSourceProperties { if (typeof source === 'number') { return { uri: Image.resolveAssetSource(source).uri, }; } - return source as ReactVideoSource; + return source as ReactVideoSourceProperties; } export function getReactTag(