Why can I not access video files from within my android application

I am at a loss here. I googled, read other posts concerning the issue with no success.

I need to build an android app that uses ffmpeg for some video decoding. For that I need to access of course videos that are stored on the device. I am trying to open movie files inside the Movies folder. Here is whats inside that folder:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>oppen:/ # ls -al storage/emulated/0/Movies/
total 174116
drwx------ 2 u0_a54 u0_a54 4096 2022-06-20 04:21 .thumbnails
-rw------- 1 u0_a54 u0_a54 77065236 2024-02-20 14:37 Ball_Net_Alpha.mov
-rw------- 1 u0_a54 u0_a54 18809864 2024-03-26 14:33 CityHall_10s_3840x2160_av1_420_60fps_8bit_16000kbps.webm
-rw------- 1 u0_a54 u0_a54 28512971 2024-03-26 11:29 Countdown_3840x2160_30sec_60fps_H265_420_10bit_better.mp4
-rw------- 1 u0_a54 u0_a54 28834060 2024-03-22 09:31 Countdown_3840x2160_30sec_audio_60fps_H265_444_10bit_better.mp4
-rw------- 1 u0_a54 u0_a54 25040410 2024-02-20 14:37 INTRODUCING_BILLABONG_SURF_SERIES.mp4
</code>
<code>oppen:/ # ls -al storage/emulated/0/Movies/ total 174116 drwx------ 2 u0_a54 u0_a54 4096 2022-06-20 04:21 .thumbnails -rw------- 1 u0_a54 u0_a54 77065236 2024-02-20 14:37 Ball_Net_Alpha.mov -rw------- 1 u0_a54 u0_a54 18809864 2024-03-26 14:33 CityHall_10s_3840x2160_av1_420_60fps_8bit_16000kbps.webm -rw------- 1 u0_a54 u0_a54 28512971 2024-03-26 11:29 Countdown_3840x2160_30sec_60fps_H265_420_10bit_better.mp4 -rw------- 1 u0_a54 u0_a54 28834060 2024-03-22 09:31 Countdown_3840x2160_30sec_audio_60fps_H265_444_10bit_better.mp4 -rw------- 1 u0_a54 u0_a54 25040410 2024-02-20 14:37 INTRODUCING_BILLABONG_SURF_SERIES.mp4 </code>
oppen:/ # ls -al storage/emulated/0/Movies/                                                                                                                                                 
total 174116
drwx------ 2 u0_a54 u0_a54     4096 2022-06-20 04:21 .thumbnails
-rw------- 1 u0_a54 u0_a54 77065236 2024-02-20 14:37 Ball_Net_Alpha.mov
-rw------- 1 u0_a54 u0_a54 18809864 2024-03-26 14:33 CityHall_10s_3840x2160_av1_420_60fps_8bit_16000kbps.webm
-rw------- 1 u0_a54 u0_a54 28512971 2024-03-26 11:29 Countdown_3840x2160_30sec_60fps_H265_420_10bit_better.mp4
-rw------- 1 u0_a54 u0_a54 28834060 2024-03-22 09:31 Countdown_3840x2160_30sec_audio_60fps_H265_444_10bit_better.mp4
-rw------- 1 u0_a54 u0_a54 25040410 2024-02-20 14:37 INTRODUCING_BILLABONG_SURF_SERIES.mp4

I set the correct (according to every post I read) permissions in the manifest file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
</code>
<code> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> </code>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

My code to display the content of the directory looks like this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> String TAG = "#######################################";
File moviesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
String mPath = moviesDir.getAbsolutePath();
Log.d(TAG, "Path to movies: " + mPath);
File[] files = moviesDir.listFiles();
if (files != null) {
for (File file : files) {
Log.d(TAG, "File: " + file.getName());
}
} else {
Log.d(TAG, "No files found in the Movies directory.");
}
</code>
<code> String TAG = "#######################################"; File moviesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES); String mPath = moviesDir.getAbsolutePath(); Log.d(TAG, "Path to movies: " + mPath); File[] files = moviesDir.listFiles(); if (files != null) { for (File file : files) { Log.d(TAG, "File: " + file.getName()); } } else { Log.d(TAG, "No files found in the Movies directory."); } </code>
        String TAG = "#######################################";
        File moviesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
        String mPath = moviesDir.getAbsolutePath();
        Log.d(TAG, "Path to movies: " + mPath);
        File[] files = moviesDir.listFiles();
        if (files != null) {
            for (File file : files) {
                Log.d(TAG, "File: " + file.getName());
            }
        } else {
            Log.d(TAG, "No files found in the Movies directory.");
        }

Here is now the problem – no matter what permission combination I tried or what code (tried Mediastore and other things) I used to display the directory content I always end up with just:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>09-12 11:15:30.336 7886 7886 D #######################################: Path to movies: /storage/emulated/0/Movies
09-12 11:15:30.346 7886 7886 D #######################################: File: .thumbnails
</code>
<code>09-12 11:15:30.336 7886 7886 D #######################################: Path to movies: /storage/emulated/0/Movies 09-12 11:15:30.346 7886 7886 D #######################################: File: .thumbnails </code>
09-12 11:15:30.336  7886  7886 D #######################################: Path to movies: /storage/emulated/0/Movies
09-12 11:15:30.346  7886  7886 D #######################################: File: .thumbnails

My videos never show up. Any Idea what I am doing wrong?

API min version 30
Android 11
x98plus android TV box device

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật