Android: The built-in media player is unable to play the media file

Created on 10 Feb 2019  路  17Comments  路  Source: nextcloud/android

I guess I found some useful information about this behavior because many people are suffering from this issue I posted at the end of this message where I think the solution is.

Actual behaviour

  • When clicking on a media file in app (mp3, mp4, mov, etc.) the message 'The built-in media player is unable to play the media file' is displayed.

Expected behaviour

  • You'd expect clicking a media file would play the file. Now you have to click on the three dots and select 'stream with' such that it will play with VLC. But you have to do this for all songs in the containing folder which is a bore. You can't listen to an album since you'd have to repeat these steps when a song finishes..

Steps to reproduce

  1. Open the app
  2. Browse to a media file
  3. Click on it to try to play the file.

Environment data

Android version:
Android 7.1.2
Stock or customized system:
Customized system
Nextcloud app version:
3.4.2
Nextcloud server version:
15.0.2

Logs

Web server error log

Nextcloud log (data/nextcloud.log)

2019/02/05 05:27:00
PreviewMediaFragment: onCreateView

2019/02/05 05:27:01
PreviewMediaFragment: onActivityCreated

2019/02/05 05:27:01
PreviewMediaFragment: onStart

2019/02/05 05:27:01
PreviewMediaFragment: Binding to MediaService...

2019/02/05 05:27:01
PreviewMediaFragment: onResume

2019/02/05 05:27:01
PreviewMediaFragment: Media service connected

2019/02/05 05:27:01
PreviewMediaFragment: starting playback of null

2019/02/05 05:27:01
MediaServiceBinder: Loading and starting through binder...

2019/02/05 05:27:01
PreviewMediaFragment: Successfully bound to MediaService, MediaController ready

2019/02/05 05:27:01
FileDisplayActivity: Media service connected

2019/02/05 05:27:01
OwnCloudClient #3: REQUEST POST /ocs/v2.php/apps/dav/api/v1/direct

2019/02/05 05:27:02
MediaService: Error in audio playback, what = -38, extra = 0

2019/02/05 05:27:03
PreviewMediaFragment: onPause

2019/02/05 05:27:03
PreviewMediaFragment: onStop

2019/02/05 05:27:03
PreviewMediaFragment: Unbinding from MediaService ...

2019/02/05 05:27:03
PreviewMediaFragment: onDestroy

2019/02/05 05:27:04
ExtendedListFragment: Setting selection to position: 0; top: 0; index: 2

I believe the main problem is the error

2019/02/05 05:27:02
MediaService: Error in audio playback, what = -38, extra = 0

I think below is some useful information to resolve this issue.
http://bighow.org/questions/21660098/android-mediaplayer-error-38-0-
https://stackoverflow.com/questions/9008770/media-player-called-in-state-0-error-38-0

approved bug

All 17 comments

I noticed I can stream media using the app until I enable https in the configuration of nginx or apache2.

I'm also unable to stream to Android. Any updates on this?

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

I have the same issue ("The built-in media player is unable to play the media file is displayed."). After trying to play the mp3 file again (and again) it works sometimes. Sometimes it is not possible to start playing the file. Later (after app restart) it works again. Broadly speaking: error is not deterministic.

3351

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

I am experiencing this issue, too. I have enabled https in my configuration of apache2. Never tried playing any media files prior to enabling https via letsencrypt.

Hi everybody, thank you for this cool client! 馃ぉ I have just installed the most recent version 3.7.0 hoping that this annoying bug has been fixed, but unfortunately it is still there. Any hints? I have also been trying dev from f-droid, but with no luck. Playback from within the browser or streaming with other clients over webdav works fine. 馃憤

It's being worked on here:
https://github.com/nextcloud/android/pull/4208

What I can say? Join in, test the dev build, raise bugs.

my log
07-18 13:21:46.169 22712 22712 E MediaPlayer: error (-38, 0)
07-18 13:21:46.169 22712 22712 E MediaPlayer: Attempt to call getDuration without a valid mediaplayer
07-18 13:21:46.170 22712 22712 E MediaPlayer: Error (-38,0)
07-18 13:21:46.170 22712 22712 E MediaService: Error in audio playback, what = -38, extra = 0
07-18 13:21:46.179 22712 22712 I MediaPlayer: [HSM] stayAwake false uid: 10113, pid: 22712
07-18 13:21:46.180 3139 4297 I MediaProcessHandler: processOp opType: 1, uid: 10113, pid: 22712
07-18 13:21:46.180 3139 4297 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10113, pid: 22712
07-18 13:21:46.180 22712 22712 I MediaPlayer: [HSM] stayAwake false uid: 10113, pid: 22712
07-18 13:21:46.180 3139 3149 I MediaProcessHandler: processOp opType: 1, uid: 10113, pid: 22712
07-18 13:21:46.180 3139 3149 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10113, pid: 22712
07-18 13:21:46.181 22712 22712 I AudioManager: abandonAudioFocus
07-18 13:21:46.183 22712 22712 I MediaPlayer: [HSM] stayAwake false uid: 10113, pid: 22712
07-18 13:21:46.183 3139 3958 I MediaProcessHandler: processOp opType: 1, uid: 10113, pid: 22712
07-18 13:21:46.183 3139 3958 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10113, pid: 22712
07-18 13:21:46.232 22712 22712 I AudioManager: requestAudioFocus() status : 1
07-18 13:21:46.233 22712 22712 I AudioManager: requestAudioFocus() apk : com.nextcloud.client
07-18 13:21:46.239 22712 22712 I AudioManager: abandonAudioFocus

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

cough

Are you trying to play the file using the "Recent" or "Audio" option in the file explorer?

Having same issue still

@MishelMF
Did it play a song before you received the mediaplayer or is it just not playing from the start?

It did. It's a bit random to be honest. I can get the song playing after multiple refresh. Same in reverse. If the song was playing before, next time I play the song again, I can get Unable to play media file. Same applies if I am on the local network or external.

Test video:

97Mb .mp4 file with 47 sec of audio, seems around 17 mega-bit per second. URL like https://my.host.hk/remote.php/direct/RDoPq.....fBAsw7K found in adb logcat indeed points to this test video and can be played by Firefox just fine on all of the mobile devices and on my PC.

Server:

Self-hosted

nextcloud-php72-16.0.4
apache24-2.4.41

FreeNAS-11.2-U7 running 11.3-RELEASE-p5 jail (works somehow) with Nextcloud setup roughly as explained here; running on HTTPS - hostname resolved from symbolic to IP, certificate signed by FreeNAS own CA, certificate imported as User CA into Android

Client 1, test 1 (NextCloud):

Netxtcloud Android app version 3.9.2
LineageOS 14.1-20171107-NIGHTLY-hlte (this is a 7.1.2)

I can use Nextcloud app as expected, except when I press on an .mp4 file to play
Netxtcloud Android app version 3.9.2

  • before "importing from SD card" my own root CA certificate: no playback at all; after a long time I got The built-in media player is unable to play the media file message
  • after I "imported from SD card" my own root CA certificate: playback starts but gets stuck after about 7 seconds:

Some fragments of adb logcat:

12-31 04:19:00.181   347 10029 I NuCachedSource2: Cache full, done prefetching for now
12-31 04:19:00.427   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 21, 0), loop setting(0, 0)
12-31 04:19:01.427   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 21, 0), loop setting(0, 0)
12-31 04:19:01.635   336   594 D AudioFlinger: mixer(0xb5883a40) throttle end: throttle time(9)
12-31 04:19:02.428   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 22, 0), loop setting(0, 0)
12-31 04:19:03.429   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 22, 0), loop setting(0, 0)
12-31 04:19:04.431   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 22, 0), loop setting(0, 0)
12-31 04:19:04.997   347 10029 I NuCachedSource2: restarting prefetcher, totalSize = 4325376
12-31 04:19:05.085   347 10029 I NuCachedSource2: new range: offset= 14326926
12-31 04:19:05.433   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (3, 22, 0), loop setting(0, 0)
12-31 04:19:05.433   347 10030 D GenericSource: startBufferingIfNecessary_l
12-31 04:19:05.434   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (200, 703, 37652), loop setting(0, 0)
12-31 04:19:05.435   347 10026 I NuPlayer: buffer low, pausing...
12-31 04:19:05.435   347 10026 D NuPlayerDriver: notifyListener_l(0xb5d2af60), (200, 701, 0), loop setting(0, 0)eden.24x7.hk
12-31 04:19:05.435  4922  7677 W MediaPlayer: info/warning (703, 37652)
12-31 04:19:05.436  4922  7677 W MediaPlayer: info/warning (701, 0)
```https://internals.rust-lang.org/

Client 1, test 2 (MX Player from URL)
============================

I've found a URL like this in my logs `https://my.host.hk/remote.php/direct/RDoPq.....fBAsw7K` . 

MX Player initially refused to play it at all for me. However once I temporarily disabled HTTP -> HTTPS forwarding in my `apache24` server configs and asked MX Player to play `http://my.host.hk/remote.php/direct/RDoPq.....fBAsw7K` it started exhibiting exactly the same behavior as Nextcloud: it starts playing and then gets stuck at second 7. Some `adb logcat` fragments:

```Netxtcloud Android app version 3.9.2
12-31 12:15:16.620   347  4122 I NuCachedSource2: restarting prefetcher, totalSize = 2228224
12-31 12:15:16.736   347  4122 I NuCachedSource2: new range: offset= 16501377
...
12-31 12:15:17.310   347  4123 D GenericSource: startBufferingIfNecessary_l
12-31 12:15:17.310   347  4120 D NuPlayerDriver: notifyListener_l(0xb5d2b140), (3, 23, 0), loop setting(0, 0)
12-31 12:15:17.310   347  4120 D NuPlayerDriver: notifyListener_l(0xb5d2b140), (200, 703, 15390), loop setting(0, 0)
12-31 12:15:17.310   347  4120 I NuPlayer: buffer low, pausing...
12-31 12:15:17.310   347  4120 D NuPlayerDriver: notifyListener_l(0xb5d2b140), (200, 701, 0), loop setting(0, 0)
12-31 12:15:17.310  3387  4124 W MediaPlayer: info/warning (703, 15390)
12-31 12:15:17.310  3387  4124 W MediaPlayer: info/warning (701, 0)

Client 2 (NextCloud test only):

Netxtcloud Android app version 3.9.2
Moto G5 Plus: Android 7.0 Build Number NPN25.137-93

Same behavior: can start playing that same video with video player built into NextCloud App but it stops after 7 seconds. Some adb logcat fragments:

12-31 13:14:31.491  2055 19624 D NuPlayerDriver: notifyListener_l(0xb222acc0), (3, 38, 0), loop setting(0, 0)
12-31 13:14:31.970  2055 19627 I NuCachedSource2: restarting prefetcher, totalSize = 2949120
12-31 13:14:32.033  2055 19627 I NuCachedSource2: new range: offset= 31625788
12-31 13:14:32.134 17344 18487 I MediaHTTPConnection: proxyName: 0.0.0.0 0
12-31 13:14:32.486   585   585 I SFPerfTracer:       trigger: frame rate (-48.603%)     (30.838 fps)    (32.428 ms)     (296 drops)     (450 frames)
12-31 13:14:32.486   585   585 I SFPerfTracer:      triggers: (rate: 30:2128) (compose: 0:14) (post: 0:36) (render: 4:50) (450:33069 frames) (451:36610)
12-31 13:14:32.487   585   585 D SFPerfTracer:        layers: (4:10) (StatusBar (0xa7acac00): 6:11453) (com.android.systemui.ImageWallpaper (0xa7e07400): 0:6406)* (animation background stackId=1 (0xa7
af6000): 0:37)* (Sprite (0xa7ac7000): 0:33)* (NavigationBar (0xa7ac8400): 0:5046) (DimLayerController/Stack=0 (0xa7af9c00): 0:623)* (DockedStackDim (0xa7e06000): 0:11)* (com.nextcloud.client/com.owncl
oud.android.ui.activity.FileDisplayActivity (0xa650a000): 16:167) (SurfaceView - com.nextcloud.client/com.owncloud.android.ui.activity.FileDisplayActivity (0xa650dc00): 0:9)* (SurfaceView - com.nextcl
oud.client/com.owncloud.android.ui.activity.FileDisplayActivity (0xa650b400): 439:449) 
12-31 13:14:32.491  2055 19628 D GenericSource: startBufferingIfNecessary_l
12-31 13:14:32.492  2055 19624 D NuPlayerDriver: notifyListener_l(0xb222acc0), (3, 38, 0), loop setting(0, 0)
12-31 13:14:32.492  2055 19624 D NuPlayerDriver: notifyListener_l(0xb22NuPlayer: buffer low, pausing2acc0), (200, 703, 60638), loop setting(0, 0)
12-31 13:14:32.492  2055 19624 I NuPlayer: buffer low, pausing...
12-31 13:14:32.492  2055 19624 D NuPlayerDriver: notifyListener_l(0xb222acc0), (200, 701, 0), loop setting(0, 0)
12-31 13:14:32.492 17344 17707 W MediaPlayer: info/warning (703, 60638)
12-31 13:14:32.492 17344 17707 W MediaPlayer: info/warning (701, 0)

Client 3 (NextCloud test only):

Netxtcloud Android app version 3.9.2
LineageOS 14.1-20181204-NIGHTLY-v1awifi

Same behavior observed: video starts playing in the player built into NextCloud App but gets stuck after 7 seconds. No logs here

Wild guess (not likely)...

Hmm.. could this be somehow related?...

P.S. same result with another similarly

On a smaller mp4 from same phone

Okay, I created a 12 sec video. It plays, then there is a small hiccup and then it continues. Posting adb logcat here because it seems that on longer videos this same hiccup is bigger and actually the player never gets over it..

12-31 14:41:06.765   347 18329 I NuCachedSource2: restarting prefetcher, totalSize = 3735552
12-31 14:41:06.866   347 18329 I NuCachedSource2: new range: offset= 14699085
12-31 14:41:07.227   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (3, 90, 0), loop setting(0, 0)
12-31 14:41:07.228   347 18338 D GenericSource: startBufferingIfNecessary_l
12-31 14:41:07.229   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (200, 703, 39128), loop setting(0, 0)
12-31 14:41:07.229   347 18326 I NuPlayer: buffer low, pausing...
12-31 14:41:07.229   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (200, 701, 0), loop setting(0, 0)
12-31 14:41:07.231 18161 18330 W MediaPlayer: info/warning (703, 39128)
12-31 14:41:07.233 18161 18331 W MediaPlayer: info/warning (701, 0)
...
12-31 14:41:08.230   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (3, 90, 0), loop setting(0, 0)
12-31 14:41:08.525   777   850 W ConnectivityExtension: ConnectivityExt jar file not present
12-31 14:41:08.842   347 18329 I NuCachedSource2: caching reached eos.
12-31 14:41:09.231   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (3, 100, 0), loop setting(0, 0)
12-31 14:41:09.231   347 18338 D GenericSource: stopBufferingIfNecessary_l
12-31 14:41:09.232   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (200, 703, 39128), loop setting(0, 0)
12-31 14:41:09.232   347 18326 I NuPlayer: buffer ready, resuming...
12-31 14:41:09.233   347 18326 D NuPlayerDriver: notifyListener_l(0xb5d2ae40), (200, 702, 0), loop setting(0, 0)
12-31 14:41:09.235 18161 18330 W MediaPlayer: info/warning (703, 39128)
12-31 14:41:09.235 18161 18330 W MediaPlayer: info/warning (702, 0)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JSoko picture JSoko  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments

Bugsbane picture Bugsbane  路  3Comments

rainer042 picture rainer042  路  3Comments