Checkpoint audio-only Skald fork work

This commit is contained in:
Storm Dragon
2026-05-18 13:06:57 -04:00
parent a8ada950d5
commit 965347cad4
48 changed files with 1080 additions and 3651 deletions
+19 -20
View File
@@ -19,15 +19,14 @@ well as all the associated streams. Unless your frontend communicates
with multiple servers, it will probably create just a single instance of
this class.
The class `Stream` encapsulates a set of related audio and video tracks
(for example, an audio track from a microphone and a video track from
a webcam). A stream is said to go *up* when it carries data from the
client to the server, and *down* otherwise. Streams going up are created
by the client (your frontend), streams going down are created by the server.
The class `Stream` encapsulates a set of related audio tracks. A stream
is said to go *up* when it carries data from the client to the server, and
*down* otherwise. Streams going up are created by the client (your
frontend), streams going down are created by the server.
## Connecting to the server
First, fetch the `.status` JSON at the group URL:
First, fetch the `.status` JSON at the hall URL:
```javascript
let r = await fetch(url + ".status");
@@ -57,11 +56,11 @@ have been closed by the time it is called. The `onusermessage` callback
indicates an application-specific message, either from another user or
from the server; the field `kind` indicates the kind of message.
Once you have joined a group (see below), the remaining callbacks may
Once you have joined a hall (see below), the remaining callbacks may
trigger. The `onuser` callback is used to indicate that a user has joined
or left the current group, or that their attributes have changed; the
or left the current hall, or that their attributes have changed; the
user's state can be found in the `users` dictionary. The `onchat`
callback indicates that a chat message has been posted to the group, and
callback indicates that a chat message has been posted to the hall, and
`onclearchat` indicates that the chat history has been cleared. Finally,
`ondownstream` is called when the server pushes a stream to the client;
see the section below about streams.
@@ -72,11 +71,11 @@ You may now connect to the server:
serverConnection.connect(status.endpoint);
```
You typically join a group in the `onconnected` callback:
You typically join a hall in the `onconnected` callback:
```javascript
serverConnection.onconnected = function() {
this.join(group, 'join', username, password);
this.join(hall, 'join', username, password);
}
```
@@ -85,10 +84,10 @@ will trigger. There, you update your user interface and request incoming
streams:
```javascript
serverConnection.onjoined = function(kind, group, perms, status, data, error, message) {
serverConnection.onjoined = function(kind, hall, perms, status, data, error, message) {
switch(kind) {
case 'join':
this.request({'':['audio','video']});
this.request({'':['audio']});
// then update the UI, possibly taking perms.present into account
break;
case 'change':
@@ -113,7 +112,7 @@ serverConnection.onjoined = function(kind, group, perms, status, data, error, me
## Sending and receiving chat messages
Once you have joined a group, you send chat messages with the `chat`
Once you have joined a hall, you send chat messages with the `chat`
method of the `ServerConnection` class. No permission is needed to do that.
```javascript
@@ -133,11 +132,11 @@ chat messages, application-specific messages are not interpreted by the
server; unlike chat messages, they are not kept in the chat history.
The `useraction` method is used to ask the server to act on a remote user
(kick it, change its permissions, etc.); similarly, the `groupaction`
class requests an action to be performed on the current group. Most
(kick it, change its permissions, etc.); similarly, the `hallaction`
class requests an action to be performed on the current hall. Most
actions require either the `Op` or the `Record` permission.
## Accepting incoming video streams
## Accepting incoming audio streams
When the server pushes a stream to the client, the `ondownstream` callback
will trigger; you should set up the stream's callbacks here.
@@ -150,7 +149,7 @@ serverConnection.ondownstream = function(stream) {
}
```
The `stream.label` field is one of `camera`, `screenshare` or `video`.
The `stream.label` field is normally `audio`.
After a new stream is created, `ondowntrack` will be called whenever
a track is added.
@@ -166,11 +165,11 @@ parameter is true when the stream is being replaced by a new stream; in
that case, the call to `onclose` will be followed with a call to
`onstream` with the same `localId` value.
## Pushing outgoing video streams
## Pushing outgoing audio streams
If you have the `present` permission, you may use the `newUpStream` method
to push a stream to the server. Given a `MediaStream` called `localStream`
(as obtained from `getUserMedia` or `getDisplayMedia`).
(as obtained from `getUserMedia`).
```javascript
let stream = serverConnection.newUpStream();