Alex
12/28/2021, 12:44 PMAlex
12/28/2021, 12:45 PMCaused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadStorageProvider uri <content://com.android.providers.downloads.documents/document/raw:/storage/emulated/0/Download/kitty.mp4> from pid=20754, uid=10171 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
Alex
12/28/2021, 12:46 PMOpenDocument()
activity result listener and set the following flags on the intent:
addFlags(FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
addFlags(FLAG_GRANT_READ_URI_PERMISSION)
Alex
12/28/2021, 12:46 PMcontentResolver
to receive a lasting permission:
contentResolver.takePersistableUriPermission(uri, FLAG_GRANT_READ_URI_PERMISSION)
Alex
12/28/2021, 12:47 PMMediaItem.fromUri(videoUri)
and set it on the playerAlex
12/28/2021, 12:48 PMgetContent()
as an ActivityResultListener
but that didn't help.. I suspect the exoplayer starting a player thread with a non-permission enabled contentResolver
or something to that effect but I cannot put my finger on it yet. Did someone use SAF with ExoPlayer and can help me out here?