shared media servers

This commit is contained in:
2026-08-28 15:56:19 +02:00
parent 2452e6fba3
commit 059a1e2668
5 changed files with 152 additions and 14 deletions
+16 -5
View File
@@ -5,6 +5,7 @@
racket/base
racket/contract
racket-audio-dlna
racket-upnp/media-file-server
racket-upnp/media-renderer))
@title{racket-audio-dlna}
@@ -21,6 +22,8 @@ control.
@defproc[(make-dlna-player
[renderer media-renderer?]
[#:media-file-server file-server
(or/c #f media-file-server?) #f]
[#:listen-ip listen-ip (or/c #f string?) #f]
[#:port port exact-integer? 8080]
[#:path path string? "/racket-audio-dlna/"]
@@ -29,9 +32,15 @@ control.
volume-poll-seconds (and/c rational? positive?) 5.0])
dlna-player?]{
Creates a player for @racket[renderer] and starts its local HTTP media server.
When @racket[listen-ip] is @racket[#f], the address is selected from the
network route to the renderer.
Creates a player for @racket[renderer]. When @racket[file-server] is
@racket[#f], the player starts and owns a local HTTP media server. When a
@racket[media-file-server?] is supplied, the player publishes through that
shared server in an automatically generated private path. Closing the player
removes its publications but does not stop the shared server.
The @racket[listen-ip], @racket[port], and @racket[path] arguments configure
only a media server created by the player. When @racket[listen-ip] is
@racket[#f], the address is selected from the network route to the renderer.
The player polls transport state and position every @racket[poll-seconds].
Volume and mute state are refreshed every @racket[volume-poll-seconds].
@@ -194,8 +203,10 @@ Changing the file therefore invalidates its cached metadata.
@defproc[(dlna-player-close! [player dlna-player?]) void?]{
Stops playback, removes current and next publications, stops the HTTP server,
and terminates the polling thread. Repeated calls have no effect.
Stops playback, removes current and next publications, and terminates the
polling thread. A media server created by the player is also stopped. A shared
server supplied to @racket[make-dlna-player] remains running. Repeated calls
have no effect.
}
@section{Example}