Skip to content

fix: dataSource of CachedVideoPlayerPlus.file is not a valid file path#103

Merged
OutdatedGuy merged 1 commit intoOutdatedGuy:mainfrom
wlodzix:fix_local_file_path
Jul 26, 2025
Merged

fix: dataSource of CachedVideoPlayerPlus.file is not a valid file path#103
OutdatedGuy merged 1 commit intoOutdatedGuy:mainfrom
wlodzix:fix_local_file_path

Conversation

@wlodzix
Copy link
Contributor

@wlodzix wlodzix commented Jul 25, 2025

I found out that issue with playing local files may be related to wrong path provided to

VideoPlayerController.file(
          File(realDataSource),
          closedCaptionFile: closedCaptionFile,
          videoPlayerOptions: videoPlayerOptions,
          httpHeaders: httpHeaders,
          viewType: viewType,
        ),

Value passed here was actually URI string, which includes the file:// scheme — so it ends up being:

/file:/data/user/0/...

But File constructor expects a file system path, like:

/data/user/0/your.app/cache/....mp4

So changing the way dataSource is created for CachedVideoPlayerPlus.file constructor seems to fix the issue.

Copy link
Owner

@OutdatedGuy OutdatedGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@OutdatedGuy
Copy link
Owner

@wlodzix thanks a bunch for the PR and the detailed bug description.

@OutdatedGuy OutdatedGuy changed the title changed dataSource of CachedVideoPlayerPlus.file from Uri.toString()… fix: dataSource of CachedVideoPlayerPlus.file is not a valid file path Jul 26, 2025
@OutdatedGuy OutdatedGuy merged commit 7099869 into OutdatedGuy:main Jul 26, 2025
2 checks passed
@OutdatedGuy OutdatedGuy mentioned this pull request Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working correctly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: PlatformException(VideoError, Video player had error androidx.media3.exoplayer.ExoPlaybackException: Source error, null, null)

2 participants