deniscerri / ytdlnis

Android Video/Audio Downloader app using yt-dlp
GNU General Public License v3.0
3.62k stars 123 forks source link

[FEATURE REQUEST] Open files with direct paths and not via content URLs #518

Closed Omegaplexx closed 1 month ago

Omegaplexx commented 2 months ago

Hello! YTDLnis opens downloaded files with content:// links and that makes it inconvenient. When I click "Open" in YTDLnis dialog or notification, I often need to rename or delete the video while watching it through MX Player (it has such features). All players treat such file links as streams and cannot do anything but just play them, so I have to go to my "Downloads" folder with file explorer, open the video with direct path and get that extra functionality in player.

Can you please save my time and do the app to open downloaded files via direct paths? Shouldn't be a big deal. Thank you! :)

Sorry if there are some mistakes. Not a native Eng speaker :/

zaednasr commented 2 months ago

Do you know of any FOSS app that can do this? Because from what i know thats how you usually open files, with content URI's. 🤔

Omegaplexx commented 1 month ago

VLC and Material Files. Not sure if it answers your question, but these apps can open files by direct path from the interface

zaednasr commented 1 month ago

Do you know the source code of them? In github or something

Omegaplexx commented 1 month ago

VLC: https://code.videolan.org/videolan/vlc-android Material Files: https://github.com/zhanghai/MaterialFiles

Unfortunately, I'm not a programmer myself, so I can't read the code or explain how it works :(

zaednasr commented 1 month ago

I want to know something. If you are inside the app and open it from there, can u do your things ok?

Omegaplexx commented 1 month ago

Yeah, when I open a video from Material Files/VLC/X-plore/F-Stop or any other file manager or gallery, I can get extra functionality in player, because all these apps open files with a direct path

zaednasr commented 1 month ago

No, i mean inside the ytdlnis app, u can open the file in the downloads screen.

Omegaplexx commented 1 month ago

Oh, I get it. No, I can't. MX Player treat it as stream and shows the content:// link in the properties of the open video instead of the path Screenshot_20240712-191327_MX_Player~01

zaednasr commented 1 month ago

can you enable all files access in the app and try again?

Omegaplexx commented 1 month ago

Both MX Player and YTDLnis have storage permission. I granted it a long time ago

zaednasr commented 1 month ago

From what im testing, this only is happening when you dont have all files permission. If u have it enabled, then u can edit a file with mx player just fine Can you check in the folder settings?

Omegaplexx commented 1 month ago

I checked the permissions of both apps again and made sure that both apps has access to all files but still I can't rename/delete a file with MX Player. I think it's because content URLs don't provide access to the file itself, but only allow to read (play) it

I noticed another peculiarity. The players built into the different apps (X-plore, QuickPic Gallery, MiXplorer) react differently to links sent by YTDLnis. MiXplorer's player can't play a video stream (only audio is played), X-plore's player crashes when trying to open content://, and QuickPic player can't display the properties of the stream being played. All apps have storage access permission

zaednasr commented 1 month ago

I found another method that is files:/// but android doesnt allow to share that URI, and everywhere i looked u need to send the content uri. Not sure what im missing.

Omegaplexx commented 1 month ago

I've heard a lot of negative feedback about the Storage Access Framework API, which from what I understand is very inconvenient, slow and forces developers to use content URIs for "security" purposes. The old method of file access is called FileIO, and it seems to be that all the apps mentioned above use it. It has no restrictions on using direct file paths, and allows you to rename/delete/copy/move/edit a file or files directly from the application interface. Does YTDLnis use SAF? If yes, it's probably the reason of the issue

Omegaplexx commented 1 month ago

Screenshot_20240712-213044_Murglar_2

zaednasr commented 1 month ago

the app uses both. FileIO for deleting files and checking if they exist and SAF for opening files. There is no other way, u have to use SAF to create a VIEW intent.

Omegaplexx commented 1 month ago

Material Files is open source. It can create and open files directly from it's interface which probably means that it uses FileIO to open'em.

I also know the FSAF library. Could it be useful? https://github.com/K1rakishou/Fuck-Storage-Access-Framework

zaednasr commented 1 month ago

I studied the code and it uses SAF aswell but its different because it reimplemented almost everything, but its the same logic.

zaednasr commented 1 month ago

dm me on telegram, ill send you an apk

Omegaplexx commented 1 month ago

New version that you sent me in TG works fine. Thank you very much for your responsiveness! :)