abdallahmehiz / mpvKt

A media player for android, based on mpv-android and built with Jetpack Compose.
Apache License 2.0
575 stars 18 forks source link

not load srt file in video directory automaticaly #12

Open Monirzadeh opened 2 months ago

Monirzadeh commented 2 months ago

when i open a video in a directory like this

filename-video.mp4
filename-video.srt
filename-video.en.mp4

mpv automatically load them in linux but i have this in config (i try to use them in mpvKt but not work)

--sub-auto=exact
# or
--sub-auto=all

but mpvKt not load local subtitle automatically and each time a video i should manually load that. is it possible to fix that?

abdallahmehiz commented 2 months ago

but mpvKt not load local subtitle automatically and each time a video i should manually load that. is it possible to fix that?

mpvKt currently uses Android's SAF to load files from external storage, which abstracts away the filesystem for it thus it cannot detect these subtitle files.

to fix this i can either:

Monirzadeh commented 2 months ago

make a new subtitle detection system, using SAF, to detect subtitle files fuzzily and add them mpv.

In this one should I give acsses to that folder each time? For example I play video from gallery app (that gather media on phone in different directory)

77-77SP commented 2 months ago

but mpvKt not load local subtitle automatically and each time a video i should manually load that. is it possible to fix that?

mpvKt currently uses Android's SAF to load files from external storage, which abstracts away the filesystem for it thus it cannot detect these subtitle files.

to fix this i can either:

  • push an update with an additional permission of WRITE_EXTERNAL_STORAGE
  • make a new subtitle detection system, using SAF, to detect subtitle files fuzzily and add them mpv.

Wouldn't READ_EXTERNAL_STORAGE suffice instead of WRITE_EXTERNAL_STORAGE? It is advised not to use write permission since it would introduce a theoretical attack vector that could potentially be abused.

abdallahmehiz commented 2 months ago

Wouldn't READ_EXTERNAL_STORAGE suffice instead of WRITE_EXTERNAL_STORAGE? It is advised not to use write permission since it would introduce a theoretical attack vector that could potentially be abused.

The READ_EXTERNAL_STORAGE permission has been removed from Androids since 13

And yes, WRITE_EXTERNAL_STORAGE can be used as an attack vector, that's the reason i haven't added it.

77-77SP commented 2 months ago

Wouldn't READ_EXTERNAL_STORAGE suffice instead of WRITE_EXTERNAL_STORAGE? It is advised not to use write permission since it would introduce a theoretical attack vector that could potentially be abused.

The READ_EXTERNAL_STORAGE permission has been removed from Androids since 13

And yes, WRITE_EXTERNAL_STORAGE can be used as an attack vector, that's the reason i haven't added it.

Would the permission READ_MEDIA_VIDEO suffice? From what I gathered it was added in order to replace the WRITE_EXTERNAL_STORAGE permission.

abdallahmehiz commented 2 months ago

Would the permission READ_MEDIA_VIDEO suffice?

Unfortunately no. It gives you permission to access video files, (Or what google deems video files). And only video files.

Monirzadeh commented 2 months ago

One other small problem is that you can't add more than one external subtitle. If you add subtitle1 it show in subtitle list Now try to add another subtitle (subtitle2) You can't acsses subtitle1 anymore unless add that once again manualy

abdallahmehiz commented 2 months ago

One other small problem is that you can't add more than one external subtitle. If you add subtitle1 it show in subtitle list Now try to add another subtitle (subtitle2) You can't acsses subtitle1 anymore unless add that once again manualy

Couldn't reproduce this but found another similar bug instead thanks to you, can you check the latest nightly if this is still happening?

Monirzadeh commented 2 months ago

I think found what happening I test it on nightly. It is not show updated list of avilable SRT list after each selection. When I add 2 SRT(just show one of them) I should close subtitle list an open that list again to see all added subtitle I think it should update that after each new srt selection witout need close and reopen subtitle list

abdallahmehiz commented 2 months ago

It is not show updated list of avilable SRT list after each selection. When I add 2 SRT(just show one of them) I should close subtitle list an open that list again to see all added subtitle I think it should update that after each new srt selection witout need close and reopen subtitle list

Weird, After adding a new subtitle I can just scroll down to find it in the list. Does it not do that on your end?

Monirzadeh commented 2 months ago

no it is not happening. i should close and open that.