Skip to main content

Prerequisites

Before you begin, make sure you have the following installed:
  • Node.js 18+ — required for ESM module support
  • TypeScript 5+ — used to compile the server source
  • Git — to clone the repository

Set up the server

1

Clone the repository

Clone the project and navigate into the directory:
git clone https://github.com/swimauger/dlna.git && cd dlna
2

Install dependencies

Install the required runtime and development dependencies:
npm install
This installs cheerio (XML parsing), edge.js (templating), and TypeScript type definitions.
3

Build the project

Compile the TypeScript source to JavaScript:
npm run build
Output files are written to the out/ directory. The compiler targets ESNext with NodeNext module resolution.
4

Add a video to your gallery

Open resources/gallery.json and add your video entries. Each entry needs an id, title, mimeType, and a publicly accessible url.
resources/gallery.json
{
  "metadata": {
    "version": 1,
    "totalVideos": 2
  },
  "videos": [
    {
      "id": "1",
      "title": "My Video",
      "mimeType": "video/mp4",
      "url": "http://192.168.1.100/videos/my-video.mp4"
    },
    {
      "id": "2",
      "title": "Another Video",
      "mimeType": "video/mp4",
      "url": "http://192.168.1.100/videos/another-video.mp4"
    }
  ]
}
The url field must point to a location that your DLNA client device can reach over the network. A direct HTTP URL to the video file is required — the server does not proxy or transcode media.
Update totalVideos to match the number of entries in the videos array.
5

Start the server

Run the compiled server:
npm start

What to expect

Once started, the server logs two lines confirming both services are active:
Listening at soap://192.168.1.50:8080
Listening at ssdp://192.168.1.50:1900
  • The SOAP server listens on port 8080 and handles HTTP requests from DLNA clients — device description, ContentDirectory browsing, and event subscriptions.
  • The SSDP socket listens on UDP port 1900 and joins the 239.255.255.250 multicast group to advertise the server on your local network.
The IP address shown is auto-detected from your machine’s active network interface.

Connect a DLNA client

No manual configuration is needed on client devices. Because the server responds to UPnP M-SEARCH discovery messages, any DLNA-compatible device on the same network will find it automatically. Smart TVs — open the media source or device list; the server appears as a media server. VLC — go to View > Playlist, then expand Local Network > Universal Plug’n’Play to find the server and browse your gallery. Other clients — any UPnP/DLNA MediaRenderer or control point app (Kodi, Infuse, BubbleUPnP) will discover and connect automatically.
The server advertises itself on the network as “NodeJS Media Server” using the SERVER header node/[version] UPnP/1.1. This is the name DLNA clients display in their device lists.
During development, use npm run debug instead of npm start. This runs the server with node --watch, which automatically restarts whenever files in out/ change. Pair it with npm run watch (TypeScript watch mode) in a second terminal for a fast edit-compile-reload loop.
# Terminal 1 — recompile on source changes
npm run watch

# Terminal 2 — restart server on output changes
npm run debug