play local files to a DLNA Renderer
This commit is contained in:
@@ -1,3 +1,81 @@
|
||||
# racket-audio-dlna
|
||||
|
||||
Playing to your DLNA/UPnP Renderer over the network
|
||||
`racket-audio-dlna` plays local audio files on UPnP/DLNA media renderers.
|
||||
It combines TagLib metadata from `racket-audio` with the HTTP server,
|
||||
DIDL-Lite support, and renderer controls from `racket-upnp`.
|
||||
|
||||
```racket
|
||||
#lang racket/base
|
||||
|
||||
(require racket-audio-dlna
|
||||
racket-upnp)
|
||||
|
||||
(define renderer
|
||||
(get-media-renderer "Denon"))
|
||||
|
||||
(define player
|
||||
(make-dlna-player renderer))
|
||||
|
||||
(dlna-player-play!
|
||||
player
|
||||
"/muziek/radiohead/in-rainbows.flac")
|
||||
|
||||
(dlna-player-set-next-file!
|
||||
player
|
||||
"/muziek/radiohead/bodysnatchers.flac")
|
||||
```
|
||||
|
||||
The constructor determines the local address used to reach the renderer and
|
||||
starts a media file server on port 8080. The address, port, and URL path can be
|
||||
overridden when required:
|
||||
|
||||
```racket
|
||||
(make-dlna-player
|
||||
renderer
|
||||
#:listen-ip "10.7.3.108"
|
||||
#:port 8081
|
||||
#:path "/music/")
|
||||
```
|
||||
|
||||
## Controls
|
||||
|
||||
```racket
|
||||
(dlna-player-pause! player)
|
||||
(dlna-player-resume! player)
|
||||
(dlna-player-seek! player 120)
|
||||
(dlna-player-seek-percentage! player 50)
|
||||
(dlna-player-volume! player 35)
|
||||
(dlna-player-muted! player #t)
|
||||
(dlna-player-stop! player)
|
||||
```
|
||||
|
||||
`dlna-player-info` returns a cached snapshot:
|
||||
|
||||
```racket
|
||||
(define info (dlna-player-info player))
|
||||
|
||||
(dlna-info-state info)
|
||||
(dlna-info-position info)
|
||||
(dlna-info-duration info)
|
||||
(dlna-info-volume info)
|
||||
(dlna-info-reachable? info)
|
||||
```
|
||||
|
||||
Transport state and position are refreshed by a background thread. Position is
|
||||
advanced locally between polls. Volume and mute state use a slower cache.
|
||||
Commands update the cache immediately after the renderer accepts them.
|
||||
|
||||
Use `#:refresh? #t` for a synchronous refresh:
|
||||
|
||||
```racket
|
||||
(dlna-player-info player #:refresh? #t)
|
||||
```
|
||||
|
||||
Close the player when it is no longer needed:
|
||||
|
||||
```racket
|
||||
(dlna-player-close! player)
|
||||
```
|
||||
|
||||
Closing stops playback, removes published files, stops the web server, and
|
||||
terminates the polling thread.
|
||||
|
||||
Reference in New Issue
Block a user