|
YAACC - UPNP Client and Server
|
This app as a Sendspin player for one connection of a server (use case P1, player.md): the connection has been opened by the server (the phone listens) or by the app; the handshake is the client's either way.
More...

Classes | |
| interface | Arbiter |
Decides at every server/activate whether this connection may hold the activities it declares (several servers, one player). More... | |
| interface | Audio |
| What the app does with the stream; the calls come from the session's thread. More... | |
| interface | Controls |
| The controls of the player (the volume and mute of this player, the delay of its output). More... | |
| enum | EndReason |
| interface | Listener |
| enum | Phase |
Public Member Functions | |
| PlayerSession (Connector.Link link, Identity identity, boolean unpairedAccess, ClientCredentials credentials, HubClock clock, SecureRandom random, String name, List< PlayerMessages.Offer > formats, long bufferCapacity, int requiredLeadMs, int minBufferMs, Audio audio, Controls controls, Listener listener) | |
| PlayerSession (Connector.Link link, Identity identity, boolean unpairedAccess, ClientCredentials credentials, HubClock clock, SecureRandom random, String name, List< PlayerMessages.Offer > formats, long bufferCapacity, int requiredLeadMs, int minBufferMs, Audio audio, Controls controls, Listener listener, Arbiter arbiter) | |
| Phase | phase () |
| EndReason | endReason () |
| String | serverName () |
| String | serverId () |
| boolean | isStreaming () |
| True while a stream of the server is running. | |
| boolean | isPaired () |
| True if the PSK of the connection is a long-term one: the server is paired and proved who it is. | |
| long | serverToClientMicros (long serverMicros) |
| The server's clock as measured: the engine maps the chunk times with it. | |
| void | setDisplayRoles (List< String > roles, DisplayRoles state) |
Offers display roles besides the player (task 11.5): the metadata, artwork and color roles in roles (see DisplayRoles#roles). | |
| SourceUplink | enableSource (int sampleRate) |
Lets this phone feed audio into the server over this connection (call before start()): the hello lists the source role if the server's hello says that it takes audio. | |
| SourceUplink | sourceUplink () |
| The uplink of the source role, or null if this session was not given one. | |
| boolean | serverOffersSource () |
| True if the server said in its hello that it takes audio from a source. | |
| DisplayRoles | display () |
| What the display roles show, or null if none are offered. | |
| long | serverNowMicros () |
| The server's time now, microseconds (by the clock estimate; for what a display shows). | |
| long | serverOffsetMicros () |
| The offset of the server's clock from the client's (server minus client), in microseconds. | |
| boolean | hasClockEstimate () |
| void | setCodePairing (de.yaacc.sendspin.pairing.CodePairingClient.Offer offer, de.yaacc.sendspin.pairing.PairingWindow window, de.yaacc.sendspin.pairing.CodePairingClient.Emitter emitter) |
Offers the code-based pairing methods (call before start()): the hello lists them, and a server that activates one pairs with the code. | |
| void | onWindowOpened () |
| The operator's gesture opened the pairing window: an attempt that waited for it starts now. | |
| boolean | isPairing () |
| True while a pairing of a server with this app is under way on this connection (it is not displaced then). | |
| void | start () |
| void | close () |
| Ends the session: tells the server and closes. | |
| void | displace () |
Ends the session because another server plays to this player now (client/goodbye another_server). | |
| ServerControl | control () |
| The controller role of this connection (the connection of the player carries every role of this phone): what the server says of the group and the commands of the card. | |
| void | announceState () |
| Tells the server the volume, the mute and the delay as they are now (the user changed them on the phone). | |
| String | streamCodec () |
The codec of the stream that runs now (pcm, flac or opus), or null: which one the server chose from the offer. | |
This app as a Sendspin player for one connection of a server (use case P1, player.md): the connection has been opened by the server (the phone listens) or by the app; the handshake is the client's either way.
The session reads the hello and the activation of the server, says what the player is (client/hello, client/state), keeps the clock estimate (client/time), takes the commands for volume, mute and output delay and hands the stream to an Audio (the engine that plays it in sync). The pairing as a client is the one of the controller: a Pairing PSK activation is answered when the app holds a token. One thread; the callbacks run on it and must not block.
| de.yaacc.sendspin.client.PlayerSession.PlayerSession | ( | Connector.Link | link, |
| Identity | identity, | ||
| boolean | unpairedAccess, | ||
| ClientCredentials | credentials, | ||
| HubClock | clock, | ||
| SecureRandom | random, | ||
| String | name, | ||
| List< PlayerMessages.Offer > | formats, | ||
| long | bufferCapacity, | ||
| int | requiredLeadMs, | ||
| int | minBufferMs, | ||
| Audio | audio, | ||
| Controls | controls, | ||
| Listener | listener ) |
| link | the connection (its WebSocket handshake is done) |
| formats | the formats offered, in the order of preference |
| bufferCapacity | the bytes the player can hold |
| requiredLeadMs | how far ahead of the play time a chunk has to arrive at least |
| minBufferMs | the audio the player wants to hold at least |
| de.yaacc.sendspin.client.PlayerSession.PlayerSession | ( | Connector.Link | link, |
| Identity | identity, | ||
| boolean | unpairedAccess, | ||
| ClientCredentials | credentials, | ||
| HubClock | clock, | ||
| SecureRandom | random, | ||
| String | name, | ||
| List< PlayerMessages.Offer > | formats, | ||
| long | bufferCapacity, | ||
| int | requiredLeadMs, | ||
| int | minBufferMs, | ||
| Audio | audio, | ||
| Controls | controls, | ||
| Listener | listener, | ||
| Arbiter | arbiter ) |
| arbiter | decides between servers at every activation; null: every activation is taken (a single server) |

| void de.yaacc.sendspin.client.PlayerSession.announceState | ( | ) |
Tells the server the volume, the mute and the delay as they are now (the user changed them on the phone).
Any thread.

| void de.yaacc.sendspin.client.PlayerSession.close | ( | ) |
Ends the session: tells the server and closes.
Safe to call more than once and from the main thread.
Referenced by de.yaacc.sendspin.player.SendspinPlayerHost.disconnect().

| ServerControl de.yaacc.sendspin.client.PlayerSession.control | ( | ) |
The controller role of this connection (the connection of the player carries every role of this phone): what the server says of the group and the commands of the card.
Never null; it has no state until the server activates the role.
| SourceUplink de.yaacc.sendspin.client.PlayerSession.enableSource | ( | int | sampleRate | ) |
Lets this phone feed audio into the server over this connection (call before start()): the hello lists the source role if the server's hello says that it takes audio.
A server that keeps one connection per client (Music Assistant) has this one only.
sampleRate, the clock of the server) Referenced by de.yaacc.sendspin.player.SendspinPlayerHost.accept().

| long de.yaacc.sendspin.client.PlayerSession.serverToClientMicros | ( | long | serverMicros | ) |
The server's clock as measured: the engine maps the chunk times with it.
Safe to call from another thread.
| void de.yaacc.sendspin.client.PlayerSession.setCodePairing | ( | de.yaacc.sendspin.pairing.CodePairingClient.Offer | offer, |
| de.yaacc.sendspin.pairing.PairingWindow | window, | ||
| de.yaacc.sendspin.pairing.CodePairingClient.Emitter | emitter ) |
Offers the code-based pairing methods (call before start()): the hello lists them, and a server that activates one pairs with the code.
The window is the gesture gate; the emitter shows the code of a dynamic attempt.
Referenced by de.yaacc.sendspin.player.SendspinPlayerHost.accept().


| void de.yaacc.sendspin.client.PlayerSession.setDisplayRoles | ( | List< String > | roles, |
| DisplayRoles | state ) |
Offers display roles besides the player (task 11.5): the metadata, artwork and color roles in roles (see DisplayRoles#roles).
Before start(); the roles are listed in client/hello.
Referenced by de.yaacc.sendspin.player.SendspinPlayerHost.accept().
