Android: Media Streaming Doesn't Work

Created on 19 Sep 2018  ·  67Comments  ·  Source: nextcloud/android

Actual behaviour

  • Tell us what happens
    When tapping on a media file in the latest version of the app(3.3.0), it opens a player in the app, and then says in a little popup "Could not play the file using the builtin media player" and then it gives up.

    Expected behaviour

  • Tell us what should happen
    It should play mp3 and mp4 files when selecting them.

    Steps to reproduce

  1. Tap a media file in the Nextcloud app
  2. Media Player opens and produces the error

Environment data

Android version: 8.0

Device model: LG V30

Stock or customized system: Stock

Nextcloud app version: 3.3.0

Nextcloud server version:14.0

Logs

Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

approved bug

Most helpful comment

I'm going to ship a completely rewritten media player soon.

All 67 comments

GitMate.io thinks possibly related issues are https://github.com/nextcloud/android/pull/183 (Streaming), https://github.com/nextcloud/android/issues/1218 (Multiple picture transfer doesn't work), https://github.com/nextcloud/android/issues/1009 (Send not working), https://github.com/nextcloud/android/issues/643 (Autoupload does not work), and https://github.com/nextcloud/android/issues/294 (Instant Upload Doesn't Work (Nexus5X)).

I can confirm this bug.
Although streaming works with VLC at least (if you have it installed) by selecting the "Stream with..." option.

I can confirm this bug too, however I am experiencing the opposite in that the internal video player works if you use the stream with option, but not with normal behavior, and VLC does not work by any method.

And I can confirm that neither nextcloud, nor android media player or vlc work. VLC fails immediately and does give an error message "The location https://path_to_server_and_file cannot be played". Nextcloud loads a couple of seconds and then says "the built in media player cannot play the file". Android player just stays black.

Tested with mp4 and webm. Nextcloud 14 server. Standard Encryption module. Client Lock with system credentials.

I am having this exact same issue even with mp3's. Have to either download the file for it to play or stream with 'vlc' to play.

I completely with the above Plus it would be nice to play files by folder in case of multiple tracks (album)
.FLAC and .APE would be a nice add on

Is there something I can provide aside from a logcat? I wanted to upload a logcat but noticed it contains lots of confidential information like folder names, sync names and such.

can also confirm this bug! having this exact same issue even with mp3's. Have to either download the file for it to play or stream with 'vlc' to play.

I can confirm this bug.
Plays mp4 some Time, but not mp4, or wav.

I am having this issue also. When trying to play with the built in media player and also when trying "stream with" it always fails

Has any of you force password on share link enabled? I have a hunch that this is an issue. At least for us that cannot stream anything.

@rullzer this should not be related, or?

Nope unrelated

Similar as above. Version 3.5. Video streaming will work until switching to HTTPS. Went through 2 setups, apache2 and nginx. Both worked within the Android App prior to enabling secure connections. Reverting back fixed the streaming issue.

Found this link, possibly related... https://stackoverflow.com/questions/30166725/android-media-player-streaming-audio-file-from-https-url

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!

Issue still persists, stale[bot]. So hush...

Yeah, the problem still exists.

@breisig Can you share a link to a media file that won't play?

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!

@stale[bot] No Stalebot. This stays open until it is fixed!

Can you share a link to media that causes the issue? We can't fix it if we can't reproduce it.

On June 22, 2019 7:35:34 PM UTC, DPTJKKVH notifications@github.com wrote:

@stale[bot] No Stalebot. This stays open until it is fixed!

--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/nextcloud/android/issues/3061#issuecomment-504692720

@ezaquarii I can provide log file excerpts if you tell me what you need. I won't share full logs since I log to syslog which contains a bit too much private information. 😉 Same applies to logcat on android.

@DPTJKKVH Sorry, autocorrection messed up my previous message.

Can you pls share a link to a media that causes the issue? Media streaming works ok for me - I'm affraid that we cannot help you if we don't have any chance to investigate the issue in the first place.

@ezaquarii is the email from your github profile your "personal" email address in the sense that only you have access to it? I will send you a private share link since I don't want to publicly post my server and have random people poke around at it.

I hope my rambling is somewhat comprehensible. Thanks for offering your help, btw. 👍

@DPTJKKVH Yes, this is the right address. Please provide your application version too. Optmial solution would be to test it on daily dev build, as then I can start debugging it directly using master source code.

When you say "application version" do you mean my android app version, the nextcloud server version or a specific server app version? (In case of the latter please specify which app you mean.)

Also did you receive my link yet? If not I will send it to you manually.

btw: The last password is the right password. I never used the share feature with outside users. I didn't know that the server is generating a suitable password by itself so I set one manually after sharing the file.

@DPTJKKVH I received the file, thank you. Generally when you report any bug they will require both versions: mobile app and server, including any HTTP server too.

I tested the mp3 file and I can confirm that I can play it just fine.
However, when I select the file and open "3 dots" menu, "Stream with...", nothing happens.

I also tried to play OGG Vorbis file and it launched in the built-in player but shown "Could not play the file using the builtin media player" pop-up error message.

@DPTJKKVH Can you pls describe exactly the steps you take to reproduce the problem? It looks like there are several issues here and we need to investigate all of them separately.

Nice tune, BTW. ;)

@tobiasKaminsky @AndyScherzinger Is Nextcloud app using OS player or some custom, built-in app to decode media? I'd expect my Android stock media player to be able to play OGG Vorbis files.

The tune is from Bensound. He offers very nice royalty free music. Guess I better link back to him, to comply with the creative commons license
;) https://www.bensound.com/

Also what do you mean with ogg file? I only shared a mp3 with you, didn't I?

Sorry for the following bad formatting but I'm on mobile right now:

I use Android 9 and my Nextcloud Android version is 3.6.2.

My nextcloud server Version is 16.0.1.1

Ubuntu Server 18.04

Apache2 (exact version I look up when needed)

PHP 7.2.17

MySQL 5.7.26

Those are my activated server apps: https://pasteboard.co/IkQIL15.jpg

  1. Reproducing the error is easy. I upload a audio or video to nextcloud. I navigate nextcloud for android to it. Either by directly tapping the file or choosing the three dots and saying stream with... I cannot stream the file. The nextcloud app built in player loads for a couple of moments and then says it cannot be played. The Android built in player loads infinitely and VLC says the source cannot be played. I described my errors in one of my posts above in greater detail if needed.

@ezaquarii we use the built in capabilities

@ezaquarii @AndyScherzinger Just to make sure: Do you need additional information?

Also @ezaquarii when you say you were able to play the mp3 just fine you say that the streaming worked with the Nextcloud App, right?

Do you use the PlayStore variant or the OSS variant without proprietary Google code? I use the latter. Maybe the OSS variant is lacking codecs to play media files?

@DPTJKKVH thank you for all the information. I'm trying to debug it and it looks like playing media that is downloaded works ok. There is a problem with streaming audio only.

@DPTJKKVH it looks like the player is started without preparation. The callbacks are not firing.
I'm considering a fix for it now.

Yeah, if the media is downloaded then it seems to play [mp3's tested] but it won't work with streaming audio.

I'm going to ship a completely rewritten media player soon.

@ezaquarii Thank you a million! I really was dreading the missing streaming feature since I could use is for leisure and work but wasn't able to. I'm looking forward to test your player.

After reading this thread I have just tried to download the mp3 before playing and it turns out that it really works, so I can confirm that the bug is related to streaming. What about automatically downloading the file when it is missing locally?

What about automatically downloading the file when it is missing locally?

I can imagine it being slow, so some people want to stream it.

Yes, downloading defeats the purpose of streaming. If I have a 300 MB video file I want to stream it so I can start watching while the rest is downloading in the background.

For what it's worth, my Android 8.1 based phone also doesn't play, or stream, with 3.7.1 of the app. Of course, at least for MP3's (haven't tried video) if you want to stream you can just use the bog standard web interface on the phone as well; I have the Audio plugin installed and that works great over Firefox on Android too. Hoping for good things with an improved player.

I've fixed streaming problem on Android 9 adding

<network-security-config>
<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>

<domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">localhost</domain>
    <domain includeSubdomains="true">radioradicale.it</domain>
</domain-config> 

</network-security-config>

in network_security_config.xml under project-root/resources/android/xml

like explained here: https://stackoverflow.com/a/57108997/2527604

@ezaquarii Great work! I skimmed through your PR and I can tell you spend quite some time to fix this media player issue.

@AndyScherzinger @tobiasKaminsky User reports varied a lot on when and how exactly the old media player failed to work. Will there be a 3.9.0 beta or RC so we can do some testing before the actual release?

For 3.9.0 there will of course be a RC, other than that you can install tomorrow's Dev build which then ships the latest development version including this change and it is installed in parallel to the official build.

I see that compiled dev builds are published on f-droid with a couple days delay. I'll be using this version then. I don't have a google account (play store) and dev builds are only published as source code on github, right?

Dev builds are published on f-Droid only while you can check for new versions within the app's settings page I think.

While @tobiasKaminsky knows best!

Great to see this issue has been fixed. Yes, the dev build is on F-Droid. It is a featured app, and it is easy to find. (Current version is from 24 September 2019 and does not yet contain the fix.)

The is rather part of 20191001 since it has been merged less that a day ago so it'll go into the next nightly build.

I tested with 20191005 and neither MP3 nor MP4 can be streamed. Tested with Nextcloud "built-in" media player, VLC and mpv-android.

The error is 100% the same. VLC is the most descriptive saying: "Cannot access resource at $URL"

It is partially working on Dev 20191005.
For some media it does work (for example the Nextcloud logo animation and some cropped videos i had), but for others it is not (example is HD videos from phones). Maybe it is related to codecs or resolution?
VLC works with everything.

I doubt it is related to resolution. I tried both HD and SD mp4 videos. Also mp3 is so common it works with basically everything nowadays.

As I said I tried to "Stream with..." VLC and it gave the error I quoted above.

To be honest I always doubted the access errors had anything to do with the actual player.

If you ask me it has to do with our server forcing passwords for link shares. At least for the "Stream with..." option Nextcloud is creating a share link as far as I can tell by the VLC error. Right from the start I wondered how they get around the password requirement without creating a possible backdoor for creating passwordless share links on a forced password setup. (I hope that wasn't too confusing.)

So I want to raise this question again: Are you really 100% sure that forcing passwords for share links really does not conflict with the "Stream with..." option that (as far as I can tell) creates a share link for the external media player to use?

@AndyScherzinger @rullzer @tobiasKaminsky

Right from the start I wondered how they get around the password requirement without creating a possible backdoor for creating passwordless share links on a forced password setup. (I hope that wasn't too confusing.)

When requesting such a link, no regular share link is created, but a special password-less link that only lasts 24h.
As the url is nowhere exposed and read-only for only the specific file this is a good solution security wise.
As the link always is 32 chars, chances are also very limited to guess/bruteforce it.

As I said I tried to "Stream with..." VLC and it gave the error I quoted above.

VLC definitely works for me with anything i throw at it in both the stable and the dev version.

I'm looking for differences of your and my setup. @gradinaruvasile

I use an app token (with file access activated of course) for the nextcloud android app. How do you authenticate with the android app?

@tobiasKaminsky Thanks for the explanation. When the link is passwordless what else could block access to the file when downloading it via nextcloud app works without issues? VLC is explicitly saying it cant access the resource at $URL (hostname + path + auth-key)

To preempt some questions: VLC and mpv-android have full internet and storage access in android permissions manager. There is no firewall blocking either. Accessing other online ressources works fine with VLC.

I'm looking for differences of your and my setup. @gradinaruvasile

I use an app token (with file access activated of course) for the nextcloud android app. How do you authenticate with the android app?

I believe the same as you. I just created an app password and scanned the qr code with the NC app.

@tobiasKaminsky Thanks for the explanation. When the link is passwordless what else could block access to the file when downloading it via nextcloud app works without issues? VLC is explicitly saying it cant access the resource at $URL (hostname + path + auth-key)

Tricky question. It is a normal url, which goes to a special endpoint within Nextcloud.
@rullzer do you have an idea?

@DPTJKKVH are you using server side encryption by any chance? With user keys? because in that case it won't work. Since the token does not have your password hence it can't unlock your files.

@rullzer Yes I do have server side crypto with user keys.

But now I'm curious: Sharing files with third parties via link works without issues on my setup. So users can expose individual files or folders on demand, regardless of the current encryption.

Is there a reason why media streaming links are treated different from normal share links in this regard?

What effectively happens during link sharing is that the file gets encrypted with the system key that is why it can be decrypted without knowing your password.

This step is probably missing in the direct link creation.

Streaming and playing in background is working for me with ogg, mp3, mp4, m4a (but, as already mentioned, not with aac) using server-side encryption. The only thing that is not working for me is the "Streaming with…" button in the menu. (Nothing happens when I click on it.)

I have a Debian 10 + apache2 + HTTPS + nextcloud 16 + Server side encryption and do have the same problem: I cannot stream mp4 nor use external player from Android app

Workaround : If I create a public link, then use external Player within the app, it is working

Info: Streaming via Web Player works and the ios app was also working

Debug : If needed, I can share an account via private message to allow you to reproduce it at will?

for me, I use a apache2 server on ubuntu 18 on windows subsystem for linux.

When visiting the app on android, mp4 video files works well on the native nextcloud app but not on the stream with vlc.
for .mpk , it just gives sound on native and media player and load indefinitely on vlc.

on ios on my ipad air it just doesnt seem to work.

ok. After some research , I just found out that the player is the reason for what codec is supported. So for example for my mkv files the player KMplayer does well on android but vlc doesnt and the native app neither . for mp4 native does well and vlc doesnt but the other two works... Sooo thats it , if it doesnt work for you , just check different video player supporting the codec and you will find one !

I have a Debian 10 + apache2 + HTTPS + nextcloud 16 + Server side encryption and do have the same problem: I cannot stream mp4 nor use external player from Android app

Workaround : If I create a public link, then use external Player within the app, it is working

Info: Streaming via Web Player works and the ios app was also working

Debug : If needed, I can share an account via private message to allow you to reproduce it at will?

I have the exact same setup and symptoms and workaround but with version 18.0.2.
1) Does problem come from the fact that we enabled encryption ? But it is working on iOS app and Web players
2) Since it doest not affect everybody, I am wondering what is the source of the problem (encryption, cumulative upgrades, apache2 setup) should I test with nginx ?
3) What debug info we should provide to help here
4) I can also share an account via PM

Best Regards

Can you try to mount the webdav share and play a video with a local player ? I suspect that the issue comes from webdav which reduce the traffic... So heavy videos as issue to load ....

Hey all, I had this problem and saw someone mentioning this failing when they enabled TLS. My nextcloud server is behind a proxy, which handles TLS, and the proxy itself happens via http. When vlc failed to stream a file, I saw that the url it tried to load was actually incorrect.

My problem went away when I configured my config.php according to https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html.

The nextcloud self-check didn't detect this, but then possibly it can't.

Maybe it helps someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasKaminsky picture tobiasKaminsky  ·  3Comments

Shagequi picture Shagequi  ·  3Comments

rainer042 picture rainer042  ·  3Comments

daywalk3r666 picture daywalk3r666  ·  3Comments

JSoko picture JSoko  ·  3Comments