-
Notifications
You must be signed in to change notification settings - Fork 2
API
The following API is in place. Changes will be documented in this Wiki.
Servers must act on the following instructions.
A client wishes to join a party. He thereby subscribes to video updates (play
, pause
, seek
) & party state updates (e.g. when somebody joins or leaves the party).
{
"type":"join",
"data":{
"guid":"client-guid",
"partyId":"someId",
"clientState":{
"clientName":"guest",
"currentlyWatching":"www.example.com"
}
}
}
Leaving a party is handled when a Websocket closes. There is no specific instruction to leave a party.
The server may be asked to forward a instruction to all clients of a given party. Valid variants for videoUpdate
are play
, pause
& seek
.
{
"type":"forward",
"data":{
"commandToForward":{
"type":"videoUpdate",
"data":{
"variant":"play",
"tick":1000
}
}
}
}
Clients can send this instruction, if they wish to update their client state.
{
"type":"clientUpdate",
"data":{
"newClientState":{
"currentlyWatching":"www.youtube.com"
}
}
}
Clients must act on the following instructions:
The server can tell clients to play
, pause
or seek
within the context of the video currently present in the client's tab's DOM.
{
"type":"videoUpdate",
"data":{
"variant":"playPause",
"tick":1000,
"peer":{
"uuid":"client-party-uuid",
"clientName":"clientXYZ",
"currentlyWatching":"www.youtube.com"
}
}
}
The server can instruct clients to update their party state. Among other things, this tells the client which peers are currently present in the party and what Website they're currently on.
{
"type":"partyStateUpdate",
"data":{
"partyState":{
"isActive":true,
"partyId":"someId",
"peers":[
{
"uuid":"client-party-uuid",
"clientName":"clientXYZ",
"currentlyWatching":"www.youtube.com"
}
]
}
}
}