Skip to content Skip to sidebar Skip to footer

Amediaextractor Setdatasource Amedia_error_unsupported Error On Android Q

I am working with AMediaCodec and AMediaExtractor, all works fine on all devices(I hope:), but if I check the same code on Android Q (in my case Pixel 2XL) I got such error AMEDIA_

Solution 1:

This to me seems a bug on Android 10. It seems that android:requestLegacyExternalStorage="true" does not change the situation. You may have to request <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE/> on manifest and ask same permission at runtime. The AMediaExtractor_setDataSource function must be called on a thread that is attached to Java. Doing all of that correctly will allow you to make it work on other versions of Android but not on Android 10. I've reported the issue on Android Bug Tracker here: https://issuetracker.google.com/144837266 As per google answer, it seems that all the app using native libraries that require file access through path can be affected and they know the issue https://www.youtube.com/watch?v=UnJ3amzJM94 .

A workaround in my case was to use AMediaExtractor_setDataSourceFd, getting the file descriptor at Java level through contentResolver and its method openFileDescriptor.

Solution 2:

Post a Comment for "Amediaextractor Setdatasource Amedia_error_unsupported Error On Android Q"