ExoPlayer source only from assets or URI

Sorry, I asked this question a few days ago on a wrong topic and have now deleted it there. So again:

Is there a reason why the ExoPlayer can only play files from the assets or via URI and not from /storage/emulated/0/Music or an app-specific folder: /storage/emulated/0/Andoid/data/packageName/files/? For the last one no READ/WRITE_EXTERNAL_STORAGE permissions are requested.

I tried it before. ExoPlayer does not play a file outside the assets.

Do not use this folder. This folder should only be used for really small files since the system can delete this files automatic on anytime.

In the next major release the ExoPlayer can play files from external cards.
So please be patient for the next release.

1 Like

Hi Mika,

Thank you for your answer!

This directory /storage/emulated/0/Andoid/data/packageName/files/ is specifically recommended by Google to access data without READ / WRITE_EXTERNAL_STORAGE permissions. Manifest.permission  |  Android Developers

I use this app-specific folder in many of my apps without any issues. Unfortunately, Kodular (as well as AI2, Thunkable) requires read / write permissions at runtime (API> 22) for many components (in particular for the Player and File component). AppyBuilder does not (but unfortunately AppyBuilder does not have ExoPlayer). Could not you leave out this permission request from the ExoPlayer. Then you can make this request yourself if necessary.

Of course, I do not mean to remove the “android.permission.READ/WRITE_EXTERNAL_STORAGE” from the manifest, just the runtime request.

Thanks and best regards,
Anke

I know what the directory does and I know too that it does not require the permission check :smiley:
But its a lot of work to add some extra code everywhere where it CAN but must not posible.
I’ll take a look for that.

But I can not say anything else.

If you want to help me with this then you can add here in this topic a list with all components which needs this check.

2 Likes

Thanks again for your response. Only the Player and ExoPlayer component. Everything else can be done with extensions. Most important is ExoPlayer. The only drawback with ExoPlayer is that it does not have an ExoPlayer.Completed event. But I have a solution for that.

Our default “Player” will be replaced complete by “ExoPlayer” in the future since “ExoPlayer” is much faster and better.
Means… If I add the check then only for the “ExoPlayer” component.

2 Likes

Super! Best regards from Germany.

2 Likes

Don’t forget to add your country flag :smiley:

2 Likes

In the next major release you can use the internal path without read permission for android 4.4+.
Also I added the completed event.

1 Like

Great! Also without write permission?
(I need to download files (zip-file and unzip it) first to the app-specific dir, so I need also write perm.)
Thanks, I know that I have to set minSdkVersion=19

That’s why I asked above which else components you want to can read/write without permission from internal app directory :smiley:

ExoPlayer does not have write permission since it only needs read permission.
Your question if for file component, or?

1 Like

I have an extension for that and do not need the File component.

Then I dont get why you ask for write permission?!
:smiley:

1 Like

I useTaifun’s new File extension witch has also the posibility of creating an app-specific dir.
https://puravidaapps.com/file.php

Sorry! I should have only asked for the write permission, as this implicitly grants read permission.

It should works for you after we release the done changes.

2 Likes

If all of this is available in the next release, that would be really fantastic and would greatly simplify app creation. I will then switch from AI2 to Kodular with all my apps .

You are the best. Many thanks!

Finally, a small overview to the write permisssion and it’s declaration in the Manifest.

Regarding the (runtime) READ / WRITE_EXTERNAL_STORAGE permissions and the Player component, I’ve done intensive testing on more than 10 devices (API>22). These are my results:

2 Likes

As I said earlier the WRITE permission have nothing to do with Player or ExoPlayer component.

Because the players can ONLY read files.

But you are talking about the FILE component which can READ/WRITE files.
That’s why I asked you earlier which components I should edit to allow read/write without permission to app specifc directory.

Means, if you want I can look if I can do it for the file component.

1 Like

Thanks, yes I know and therefore I said / wrote “WRITE_EXTERNAL_STORAGE permission is sufficient as this implicitly grants READ permission”.

I know from many of my app users that they are “not amused” about permissions requests, so I want to avoid them as much as possible.