fix: add extra checks to determine if a file is local (#4503)

* fix: beter isLocalAsset checks

* fix: add "asset://" to possible assets paths

* Update src/Video.tsx

---------

Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
This commit is contained in:
Vijay Bindraban
2025-04-06 16:18:34 +02:00
committed by GitHub
parent 41ddc5c27a
commit a849cc19e8
+7 -2
View File
@@ -154,7 +154,12 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
const isLocalAssetFile =
typeof _source === 'number' ||
('uri' in _source && typeof _source.uri === 'number');
('uri' in _source && typeof _source.uri === 'number') ||
('uri' in _source &&
typeof _source.uri === 'string' &&
(_source.uri.startsWith('file://') ||
_source.uri.startsWith('content://') ||
_source.uri.startsWith('.')));
const resolvedSource = resolveAssetSourceForVideo(_source);
let uri = resolvedSource.uri || '';
@@ -168,7 +173,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
const isAsset = !!(
uri &&
uri.match(
/^(assets-library|ipod-library|file|content|ms-appx|ms-appdata):/,
/^(assets-library|ipod-library|file|content|ms-appx|ms-appdata|asset):/,
)
);