Skip to main content
The file resources/gallery.json is the single source of truth for your media library. When a DLNA client browses the server, the server reads this file and returns the list of videos it contains. To add, remove, or update videos, edit this file and restart the server.

Schema

The file has two top-level keys: metadata and videos.

metadata

metadata.version
number
required
The UpdateID sent to DLNA clients. Increment this value whenever you change your library so clients know to refresh their cached view.
metadata.totalVideos
number
required
The total number of video items in the library. This value is sent to clients as TotalMatches in Browse responses. It should always match the length of the videos array.

videos

videos
array
required
The list of video items the server advertises to clients.

Example

resources/gallery.json
{
  "metadata": {
    "version": 1,
    "totalVideos": 3
  },
  "videos": [
    {
      "id": "1",
      "title": "Big Buck Bunny",
      "mimeType": "video/mp4",
      "url": "http://192.168.1.100:8000/big-buck-bunny.mp4"
    },
    {
      "id": "2",
      "title": "Elephants Dream",
      "mimeType": "video/mp4",
      "url": "http://192.168.1.100:8000/elephants-dream.mp4"
    },
    {
      "id": "3",
      "title": "Nature Documentary",
      "mimeType": "video/x-matroska",
      "url": "http://192.168.1.100:8000/nature-doc.mkv"
    }
  ]
}

Important notes

  • totalVideos must match videos.length — if the values differ, some clients will display incorrect counts or fail to display all items.
  • The file is read at startup — changes to gallery.json do not take effect until you restart the server.
  • IDs must be unique — duplicate id values will cause undefined behavior in DLNA clients.
Do not use file:// paths in the url field. DLNA clients are separate network devices and cannot access your local filesystem. Every URL must be an HTTP URL reachable from the client over the network.
To serve video files stored on your machine, use a simple HTTP file server in the directory containing your videos:
npx serve /path/to/your/videos
This starts a local HTTP server (default port 3000) that exposes the files in that directory. Use the resulting URL — e.g., http://192.168.1.100:3000/my-video.mp4 — as the url in gallery.json. Make sure the port is accessible from client devices on your network.