Skip to content

Commit e1730b2

Browse files
committed
Add some docs for the player API
1 parent f6cf537 commit e1730b2

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

player/API.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
How the KaraKara Player interacts with the server:
2+
==================================================
3+
4+
1. Show a splash screen
5+
-----------------------
6+
`/queue/QUEUE_ID/random_images.json` can be useful if you want some images to
7+
use as decorations / previews
8+
9+
Format:
10+
11+
```
12+
{
13+
"data": {
14+
"images": [
15+
[... a bunch strings. TODO: where are these URLs relative to? ...]
16+
]
17+
}
18+
}
19+
```
20+
21+
22+
2. Fetch settings
23+
-----------------
24+
`/queue/QUEUE_ID/settings.json` contains a bunch of server-side settings that
25+
the client might find useful, such as the location of the websocket endpoint.
26+
27+
Format:
28+
29+
```
30+
{
31+
"data": {
32+
"settings": {
33+
[... a bunch of key-value pairs ...]
34+
}
35+
}
36+
}
37+
```
38+
39+
40+
3. Fetch the current playlist
41+
-----------------------------
42+
`/queue/QUEUE_ID/queue_items.json`
43+
44+
Format:
45+
46+
```
47+
{
48+
"data": {
49+
"queue": [
50+
{
51+
"performer_name": "bob",
52+
"track": {
53+
"title": "Some Song",
54+
"duration": 42,
55+
"attachments": [
56+
{
57+
"location": "sdfgsgdsfgdfsgd.jpg",
58+
"type": "image" // image, video, tags, srt, preview
59+
},
60+
[...]
61+
]
62+
}
63+
},
64+
[...]
65+
]
66+
}
67+
}
68+
```
69+
70+
71+
2. Open a WebSocket Control Connection
72+
--------------------------------------
73+
connect via websocket to `https://<server>/<websocket path>` (path defined in settings)
74+
- send an auth token
75+
- wait for a stream of instructions
76+
- `play`: begin playing the first track in the queue in fullscreen video view
77+
- `pause`: pause the currently playing track
78+
- `stop`: stop the currently playing track and go back to playlist view
79+
- `seek_forwards`: move the video X seconds forwards
80+
- `seek_backwards`: move the video X seconds backwards
81+
- `skip`: mark the current song as finished (skipped by an admin)
82+
- `ended`: mark the current song as finished (having ended natrually)
83+
- `queue_updated`: the client should re-fetch the latest `queue_items.json`
84+
- `settings`: the client should re-fetch the latest `settings.json`

0 commit comments

Comments
 (0)