First off all, this write up was inspired by this very good article. If you haven’t read it so far, go ahead and do it. My post was initially published on r/nextcloud and nachoparker asked me if I want to update it with some pictures and publish it here again. I was very happy to do so.
I looked for a solution to a common problem: I wanted to stream music and video files that are stored on my nextcloud to my phone where ever I am. I have an Android device, but as far as I can see, this will also work on iOS.
I’ve tried a lot of different things like music players and also file managers on Android to somehow get access to my music when I’m not at home. Nothing worked.
And then I remembered Kodi.
Here comes the magic: Kodi can stream any media using WebDAV. I’ve never used it in this way before, because at home I just mount my SMB to Kodi and can stream the things I like. But on the road this does not work (of course).
The beauty about using Kodi on your phone is that you don’t need to do anything to your nextcloud. WebDAV is active by default you don’t need any addons or special settings. So go ahead and get Kodi from the playstore or their website. There are also instructions for iOS.
Getting your music into Kodi
I will primarily guide you through the process using my music library as example, but the same steps can be applied for videos. There are some more remarks about it at the end of the article.
After installation start Kodi on your phone and tap on “Music”. It’s probably empty, except for the “Add Music” button.
Tap on it, which opens a new window where you select “Browse”.
This lists a lot of different options, for example you can also add music from your internal or external storage here. Scroll down to “Add network location” and tap on it.
The first line is “Protocol” and you need to tap the up and down buttons until you find “WebDAV server (HTTPS)” (or HTTP, depending how your nextcloud is set up). Make sure that you really select “WebDAV” and not “Webserver directory”. I only want to add my music collection at the moment, which is stored in a folder called “Music” on my nextcloud. For this reason, I simply add the folder name at the end of the “Remote path” line. The rest should look like you can see below, depending on how you access your nextcloud and where your music is of course.
Server address yourURL.dynu.net (don't put https or anything here, just the main URL. My DynDNS provider is dynu.net, change this to your needs)
Remote path nextcloud/remote.php/dav/files/your_username/Music (don't use a leading /. My nextcloud is on my server in the folder nextcloud, if yours is different you need to change this)
Port 443 (for me this doesn't seem to matter and it actually sets itself to 0 after saving everything)
Username your_username (the same a you use in "Remote path")
Password your_password (password for your_username)
If everything worked the network location will show up in the list. Again, make sure it starts with “davs://” and that Kodi inserted a slash after the main URL. If something does not look correct you can edit it by tapping on it for a couple seconds.
Tap on the path and it will open a connection to your nextcloud. You should see already sub-folders (if there are any) and files inside your “Music” folder. Don’t select anything further, just tap on “ok” and give the resource a name.
If everything worked you will be back to the first screen, where before there was only the “Add Music” option available. Now there should also be your nextcloud visible, identified by the name you just gave it (“Nextcloud Music” in my case).
Kodi will probably also ask you already if you want to add the files to your media library. Tap “Yes” and it will start scanning your nextcloud Music folder for files. You can also start this process later by tapping longer on “Nextcloud Music” and select “Scan files to media library”.
Depending on your internet connection and the size of your collection this will take a while, but you can see the progress on the top right corner of the screen. On Android you can also minimize Kodi to the background and it will continue scanning. The next time you tap on Music in the Kodi main menu, your music collection will be there.
When you add new music to your nextcloud folder, you need to rescan it with Kodi. Kodi will not do this by itself, however it knows which files it did scan already and only add the new files. This means it won’t take as long as the first scan.
The steps described here also work for videos/movies. Just select the corresponding option from the Kodi main menu. The WebDAV setting for your nextcloud will already be available and you don’t need to set it up again. However, if you defined a specific music folder for Kodi to scan in “Remote path” (as I did in this article), you need to change this or set it up in the same way, but with “Movies” at the end or something. You get what I mean.