android icon indicating copy to clipboard operation
android copied to clipboard

Android app fails to play media files (music) from bind-mounted folder

Open arkascha opened this issue 3 years ago • 13 comments

I cannot play music files with my nextcloud android app. I can navigate to the files and select them, but I only receive the error "Could not read the media file". The server log files show a 404 which is strange, since the files are clearly there and can actually be played without an issue using the web UI.

The folder holding the files is mounted (mount --bind) into the user's data files section. File permissions are like those files created by nextcloud itself: user and group ownership for account "www-data", the files are group writeable and readable for everyone. The server system is a standard Ubuntu system.

Steps to reproduce

  1. have some media files mounted into your nextcloud files section (ogg or mp3) (mount --bind)
  2. scan the file system to import those files (sudo -u www-data php -f public/occ files:scan arkascha)
  3. open the nextcloud app on an android device
  4. navigate to the media files and select one

Expected behaviour

The file should get played. Actually the UI clearly suggests that it is trying to play the file, there is even a play button.

Actual behaviour

The file is not played, I receive an error toast "Could not read the media file".

Can you reproduce this problem on https://try.nextcloud.com?

I cannot reproduce the same situation (mount --bind) on that system, so I cannot check this. Sorry.

Environment data

Android version: LineageOS 18.1 (Android 11)

Device model: Oneplus 7 Pro

Stock or customized system: Customized: LineageOS

Nextcloud app version: Version 3.19.0, installed from google

Nextcloud server version: Nextcloud version 23.1

Reverse proxy:

Logs

Web server error log

31.17.208.40 - - [13/Feb/2022:21:32:38 +0100] "POST /ocs/v2.php/apps/dav/api/v1/direct?format=json HTTP/1.1" 404 1456 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.19.0"
31.17.208.40 - - [13/Feb/2022:21:32:34 +0100] "GET /index.php/apps/files/api/v1/thumbnail/256/256/Multimedia/music/All%20Saints/Black%20Coffee.mp3 HTTP/1.1" 404 822 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.19.0"
31.17.208.40 - - [13/Feb/2022:21:32:51 +0100] "POST /ocs/v2.php/apps/dav/api/v1/direct?format=json HTTP/1.1" 404 1456 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.19.0"

Nextcloud log (data/nextcloud.log)

- - -

arkascha avatar Feb 13 '22 21:02 arkascha

@arkascha the 404 seems to be for the thumbnail, not the file itself.

Not sure if bind-mounting stuff directly into the files folders is even supported, my guess would be that it isn't. Can you try to get a logcat from the android app?. You'll need the dev version of the app for this.

AlvaroBrey avatar Feb 15 '22 16:02 AlvaroBrey

I absolutely agree that the 404 appear to be the result of an attempt to fetch meta data. Which means that no request for the content of the actual file itself is done at all. I fail to see why mounting stuff has to be "supported" by nextcloud. Those are valid entries in the file system, that should be completely transparent for the application. If not, then please explain what difference might exist.

I created the attached logcat, but from the normal installed app. It appears to indicate the same thing: fetching information about the file prior to trying to play it fails. Which is funny, since all that information is present in the WebUI of nextcloud. As already said playing those files in the WebUI works without issue. logcatNextcloudClientPlayingMediaFile.log

arkascha avatar Feb 15 '22 19:02 arkascha

Just to clarify, can you play mp3 files that are not bind-mounted, from the android app?

AlvaroBrey avatar Feb 17 '22 16:02 AlvaroBrey

A good point, sorry that I did not check myself before. Reason simply is that in my eyes the internal mounting of those files is irrelevant here. And indeed: if I copy a file to some other folder within my nextcloud account the android also fails to play the copy. Same error message, same behavior. I also uploaded a file from a completely independent source via the nextcloud desktop client, the android app also fails to play that file once it is uploaded.

arkascha avatar Feb 17 '22 18:02 arkascha

A good point, sorry that I did not check myself before. Reason simply is that in my eyes the internal mounting of those files is irrelevant here. And indeed: if I copy a file to some other folder within my nextcloud account the android also fails to play the copy. Same error message, same behavior. I also uploaded a file from a completely independent source via the nextcloud desktop client, the android app also fails to play that file once it is uploaded.

Okay so, as you suspected, the bind-mounting is irrelevant for this. It must be something else related to your server configuration then. I will dig a bit into the logs and see what I can find.

AlvaroBrey avatar Feb 17 '22 18:02 AlvaroBrey

This issue is still tagged as "needs info". Is there anything I can provide?

arkascha avatar Mar 01 '22 19:03 arkascha

This issue is still tagged as "needs info". Is there anything I can provide?

Nope, sorry, forgot to remove the label. Still haven't gotten time to look into this

AlvaroBrey avatar Mar 02 '22 09:03 AlvaroBrey

Any news or progress on this?

arkascha avatar May 22 '22 15:05 arkascha

Hi,

I think you have the same problem of me .... You can see my issue here : https://github.com/nextcloud/android/issues/10261#issuecomment-1188319929

I have the same apache access log about a 404 error when I try to play a video or a music from nextcloud folder or from bind-mounted folder.

But the difference with you, I have this problem with nextcloud android app 3.20 or above whereas all work fine witch 3.19.x and below.

If you try to play a video, is it work ?

tigermick avatar Jul 18 '22 22:07 tigermick

@tigermick I have version 3.20 on two devices now as well, still does not work. Nor did it work with 3.19. I can play neither any audio track nor any video, independent of the specific format. The logs indicate that not the actual files are the issue, but the preview which (probably) has never been generated. Pretty stupid to crash the whole process in that situation actually, if you ask me ...

arkascha avatar Jul 19 '22 14:07 arkascha

Sure, both aspects have already been discussed in this thread. The bind-mounting is not the issue here, according to the tests I specifically made. The same issue arises when using file freshly stored on standard storage locations.

On Tuesday, 15 February 2022 17:26:07 CEST Álvaro Brey wrote:

@arkascha the 404 seems to be for the thumbnail, not the file itself.

Not sure if bind-mounting stuff directly into the files folders is even supported, my guess would be that it isn't. Can you try to get [a logcat from the android app](https://github.com/nextcloud/android/blob/master/README.md#getting-deb ug-info-via-logcat-mag). You'll need the dev version of the app for this.

arkascha avatar Jul 19 '22 15:07 arkascha

according to your logs, there is a problem with your file thumbnail but also with the opening of the file itself ... Like me I think ... Did you try with older release of nextcloud android app ?

tigermick avatar Jul 19 '22 19:07 tigermick

hi, my problem is the same with @tigermick, where when I stream the video from android app 3.20, I get "Inernal streamig not possible on app and "POST /ocs/v2.php/apps/dav/api/v1/direct?format=json HTTP/1.1" 404 1383 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3" on log.

when I downgrade android app to 3.19 I can stream and "stream with..." the file. the log says: "POST /ocs/v2.php/apps/dav/api/v1/direct?format=json HTTP/1.1" 200 980 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.19.1"

mrroyh avatar Jul 20 '22 03:07 mrroyh

It's been nearly a year now and we have to assume that since then all multimedia playing is broken.

arkascha avatar Dec 17 '22 22:12 arkascha

@arkascha please try this QA APK and see if it works there

https://github.com/nextcloud/android/pull/8643#issuecomment-1357848169

AlvaroBrey avatar Dec 19 '22 15:12 AlvaroBrey

@AlvaroBrey I confirm that this QA APK works for me in a small test. Thanks!

arkascha avatar Dec 19 '22 21:12 arkascha