-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add support to write data to a File using a Uri #114
Add support to write data to a File using a Uri #114
Conversation
…to support scoped-storage enforcement in Android 10+, by using Uri instead of directly writing to File which will cause an exception
litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java
Show resolved
Hide resolved
litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java
Outdated
Show resolved
Hide resolved
litr/src/main/java/com/linkedin/android/litr/io/MediaMuxerMediaTarget.java
Outdated
Show resolved
Hide resolved
litr/src/main/java/com/linkedin/android/litr/utils/FileUtils.java
Outdated
Show resolved
Hide resolved
litr/src/main/java/com/linkedin/android/litr/utils/FileUtils.java
Outdated
Show resolved
Hide resolved
if (parcelFileDescriptor != null) { | ||
mediaMuxer = new MediaMuxer(parcelFileDescriptor.getFileDescriptor(), outputFormat); | ||
} else { | ||
throw new IOException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe MediaTargetException here as well? Use IO_FAILURE enum value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izzytwosheds, already the MediaTargetException
with IO_FAILURE
will be thrown after throwing the IOException
because there is an IOException
catch case with the try, else if you prefer to directly throw the MediaTargetException
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I see it now. Should we add a helpful message to IOException? Something like "Inaccessible URI" + outputFileUri ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes, and it's fixed now
Add support to write data to a File using a Uri, where most likely to support scoped-storage enforcement in Android 10+, by using Uri instead of directly writing to File which will cause an exception.