Skip to content
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

android 11 not working #24

Open
dineshchavhan opened this issue Jan 25, 2021 · 2 comments
Open

android 11 not working #24

dineshchavhan opened this issue Jan 25, 2021 · 2 comments

Comments

@dineshchavhan
Copy link

dineshchavhan commented Jan 25, 2021

files/ffmpeg": error=13, Permission denied

@dineshchavhan
Copy link
Author

Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:133)

@dineshchavhan dineshchavhan changed the title android 11 not workin android 11 not working Jan 25, 2021
@VivekThummar52
Copy link

in Android 10/11, according to new storage policy you can't save file in any public directory(as of i know for ffmpeg),
so what i have tried is i saved output file to app specific private directory(in Android/data/app_folder/cache/output_file) and then i moved the file to wherever i want(programmatically using InputStream and OutputStream), here's that code for moving file:

// file - output file converted using ffmpeg
// outputUri - new destination

private void copyCacheToOriginal(File file, Uri outputUri) {
    try {
        InputStream in = new FileInputStream(file);
        try {
            OutputStream out = getContentResolver().openOutputStream(outputUri);
            try {
                byte[] buf = new byte[1024];
                int len;
                while ((len = in.read(buf)) > 0) {
                    out.write(buf, 0, len);
                }
                file.delete();
            } finally {
                out.close();
            }
        } finally {
            in.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
        Toast.makeText(this, "Error Copying File", Toast.LENGTH_SHORT).show();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants