diff --git a/src/utils.ts b/src/utils.ts index 0200ffc0..4d5e29c8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -15,17 +15,28 @@ type Source = ImageSourcePropType | ReactVideoSource; export function resolveAssetSourceForVideo( source: Source, ): ReactVideoSourceProperties { + // will convert source id to uri + const convertToUri = (sourceItem: number): string | undefined => { + const resolveItem = Image.resolveAssetSource(sourceItem); + if (resolveItem) { + return resolveItem.uri; + } else { + console.warn('cannot resolve item ', sourceItem); + return undefined; + } + }; + // This is deprecated, but we need to support it for backward compatibility if (typeof source === 'number') { return { - uri: Image.resolveAssetSource(source).uri, + uri: convertToUri(source), }; } if ('uri' in source && typeof source.uri === 'number') { return { ...source, - uri: Image.resolveAssetSource(source.uri).uri, + uri: convertToUri(source.uri), }; }