Skip to content

Jellyfin Desktop Webclient Communications

Ian Walton edited this page Apr 21, 2021 · 13 revisions

This API has been removed!

The new MPV Shim webclient communications API works as follows:

You MUST specify a Content-Type of application/json; charset=UTF-8 EXACTLY. (This prevents CSRF.)

When you load the application, a <script type="application/json" id="clientData"></script> object will be injected. This data is encoded as base64. Decode it and parse it as JSON to get this client metadata object:

{
    "appName": "application name",
    "appVersion": "client version number",
    "deviceName": "player name",
    "deviceId": "device id"
}

POST /mpv_shim_session

Send the session data in this format:

{
    "address": "url of the server",
    "AccessToken": "user access token",
    "UserId": "user uuid",
    "Name": "server name",
    "Id": "server uuid",
    "username": "user name",
    "DateLastAccessed": "access date or make something up",
    "uuid": "server uuid (duplicate)"
}

This will return a 500 error if it fails or a 200 for a success.

POST /mpv_shim_event

Poll this for events that would normally come from the websocket. It will return an empty object {} if no event occurs within 5 seconds. If it does return an object, the dest flag will indicate what type of event it is. A dest value of ws means it is a forwarded websocket event, but a ServerId property will be added. A dest value of player means it is a player session object, similar to what would be returned from the Jellyfin server for remote session control. Again this endpoint requires an empty object ({}).

POST /mpv_shim_message

This is sent to the MPV player. Send an object to this in the form of:

{
    "name": "websocket event name",
    "payload": "{websocket event payload}"
}

Note that the value of payload is an object and not a string.

POST /mpv_shim_wsmessage

This is sent to the Jellyfin server. Send an object to this in the form of:

{
    "name": "websocket event name",
    "payload": "{websocket event payload}",
    "ServerId": "server uuid"
}

Note that the value of payload is an object and not a string.

POST /mpv_shim_teardown

Send an empty object ({}) to this to close all active sessions.

POST /mpv_shim_syncplay_join

Trigger the client to join a SyncPlay group by sending an object with the SyncPlay group id:

{
    "GroupId": "group id"
}