-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot play local files with hash character ('#') in filename #6470
Comments
Looks like the '#' is being interpreted as the start of the fragment of the Uri, so when we call getPath here we only get everything before the #. I've reproduced this. I'm not sure exactly the best way to fix it, but I've got some ideas. In the mean-time, I found that percent-encoding the '#' worked. So in your case you could do:
And I think you can automate this with URLEncoder (not tested):
|
Actually I think either of these are better (though neither are tested):
Or:
I'll look into:
|
Thanks a lot for having a look at this issue. |
@icbaker - WDYT about having I don't think documenting something that's come up once in the project's existence (and is a general Android question rather than anything specific to ExoPlayer) is ideal. If we documented all such questions, our documentation would probably be a mess and it would be hard to find the actual useful bits anyway. Throwing an improved error message seems preferable, but if we can detect the case accurately enough to do that, can we not just transparently "fix" it? |
…r query This doesn't change the current behaviour, just adds a clear error message to the developer with instructions on how to avoid it. Issue:#6470 PiperOrigin-RevId: 272405556
When a media source is created with a file containing hash character ('#') in filename, this file cannot be played back by ExoPlayer, as the URI Object will not provide full path in the function "uri.getPath()" used by FileDataSource.
Media source is created as follows:
MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse("/storage/emulated/0/Movies/Movie#01.mp4"));
then exception is thrown as follows:
Can this be fixed by ExoPlayer or should I avoid filenames having "# character?
The text was updated successfully, but these errors were encountered: