Samsung TVs are strict DLNA clients that expect SOAP response arguments in the order defined by the service SCPD (Service Control Protocol Description). The Browse response was using a Go map which produces random iteration order, causing arguments like Result, NumberReturned, TotalMatches, and UpdateID to appear in unpredictable order. Samsung TVs fail to parse such responses and never proceed to browse directory children, showing "no content" to the user. Replace the map[string]string return type with an ordered []soapArg slice throughout the UPnPService.Handle() interface, ensuring response arguments always appear in SCPD-defined order. See #9346
27 lines
875 B
Go
27 lines
875 B
Go
package dlna
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/anacrolix/dms/upnp"
|
|
)
|
|
|
|
const defaultProtocolInfo = "http-get:*:video/mpeg:*,http-get:*:video/mp4:*,http-get:*:video/vnd.dlna.mpeg-tts:*,http-get:*:video/avi:*,http-get:*:video/x-matroska:*,http-get:*:video/x-ms-wmv:*,http-get:*:video/wtv:*,http-get:*:audio/mpeg:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma*,http-get:*:audio/wav:*,http-get:*:audio/L16:*,http-get:*image/jpeg:*,http-get:*image/png:*,http-get:*image/gif:*,http-get:*image/tiff:*"
|
|
|
|
type connectionManagerService struct {
|
|
*server
|
|
upnp.Eventing
|
|
}
|
|
|
|
func (cms *connectionManagerService) Handle(action string, argsXML []byte, r *http.Request) ([]soapArg, error) {
|
|
switch action {
|
|
case "GetProtocolInfo":
|
|
return soapArgs(
|
|
"Source", defaultProtocolInfo,
|
|
"Sink", "",
|
|
), nil
|
|
default:
|
|
return nil, upnp.InvalidActionError
|
|
}
|
|
}
|