Urgent.News

What's breaking now, across hundreds of outlets.

Tech

A DLNA control point in Kotlin: discovery and eight SOAP actions

When you press Cast in Yonto Player on an Android phone, one of the sections in the picker is DLNA: TVs, Kodi boxes and AV receivers that take a video address and play it. DLNA is UPnP underneath, and for a sender that means UDP multicast, a couple of XML documents and a handful of HTTP POSTs. This post is about the sender side, what UPnP calls a control point, and how I wrote ours in Kotlin. Why…

In Yonto Player for Android, a DLNA control point is implemented in Kotlin on the sender side, responsible for discovery and eight SOAP actions. The protocol code is written in plain Kotlin and integrated into the app's HTTP transport, with only the UDP search itself relying on the Android libraries.

To find a renderer, the control point sends an SSDP (Simple Service Discovery Protocol) request to the multicast group (port 1900) and listens for unicast answers. The request, known as an M-SEARCH, includes the UPnP standard defined values and is sent twice due to potential UDP packet loss. The renderers respond unicast to the socket that initially requested the discovery, and the datagrams are only retrieved if the host matches the originating address.

Upon receiving the device description, the control point reads it once per location, checking if the host matches the originating address. The description is then used to identify the renderer, obtain its UDN (Unique Device Name), and control URLs for specific services such as AVTransport (for playing videos) and ConnectionManager (for managing connections and available media types).

The control point supports eight SOAP actions, including SetAVTransportURI, which sets the address of the video to play; Play, Pause, Stop, and Seek for controlling playback; GetTransportInfo for obtaining the current playback state; GetPositionInfo for retrieving the current position and duration of the video; and GetProtocolInfo for obtaining a list of supported media types. The CurrentURIMetaData field provides a small DIDL-Lite item, containing information such as the video title, class, and media type.

For sending the video, the control point relies on the renderer to fetch the file from the server using an HTTP address. If the renderer does not support a specific container format, the control point handles the re-encoding of the file based on the renderer's requirements. The control point also maintains a mapping of media container spellings to the correct formats supported by the renderer.

Finally, the control point uses polling to monitor playback state, position, and duration. This is achieved by sending GetTransportInfo and GetPositionInfo SOAP requests approximately once per second while a session is active. This polling mechanism, lacking the event-driven GENA mechanism, allows for efficient monitoring of the playback session on the local network.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How to Flatten a PDF and Remove Hidden Metadata Without Uploading Confidential Files

Every week, people fill out a W-9, sign a vendor onboarding packet, or annotate a contract, hit Save, and email the PDF assuming the document is locked.

  • PDF documents can leak confidential data through hidden metadata and editable forms.
  • Flattening techniques include vector AcroForm flattening and full-page image flattening.
  • Modern browsers can flatten PDFs locally using pdf-lib and pdf.js libraries.

Writing a Great Post Title

This is a submission for the MLH x DEV Writing Challenge What I Built Demo Partner Technologies Hackathon Experience

More from Sunday, 29 November 2026 →