Data Types
Live Assistant server provides many kinds of data types to the client. The client should request only the data types that it needs. To know how to send the requested, see here.
To correctly request a data type, send the name in camelCase. For example, to request Audience Update
data type, send audienceUpdate
instead of audience-update
or AudienceUpdate
.
Common Fields
Timestamp
The timestamp
is a Unix timestamp in milliseconds.
It is whether provided by the streaming platform or the time when the Live Assistant server received the data.
Position Data
All position related data use the screen coordinate system. The origin is at the top left corner of the screen. The x-axis is horizontal and the y-axis is vertical. The value is always number
/double
.
Shared Payloads
Some data payloads are shared between different data types:
String Content
The StringContentPayload
is used to send a string with optional language, pronunciation, translation, and translation language.
- TypeScript
- C#
type StringContentPayload = {
string: string
language?: string
pronunciation?: string
translation?: string
translationLanguage?: string
}
struct StringContentPayload
{
public string String;
public string? Language;
public string? Pronunciation;
public string? Translation;
public string? TranslationLanguage;
}
Image Content
The ImageContentPayload
is used to send an image URL with optional data URL.
The data URL is only provided when the image URL has CORS restrictions. The data URL is a base64 encoded version of the image, in the format of data:[CONTENT-TYPE];base64,XXXXXXXXXXXXX...
- TypeScript
- C#
type ImageContentPayload = {
url: string
dataUrl?: string
}
struct ImageContentPayload
{
public string Url;
public string? DataUrl;
}
Badge
The BadgePayload
represents a badge that an audience member could be wearing.
- TypeScript
- C#
type BadgePayload = {
displayName?: StringContentPayload
level: number
image?: ImageContentPayload
color?: string
}
struct BadgePayload
{
public string? DisplayName;
public int Level;
public ImageContentPayload? Image;
public string? Color;
}
Audience
The AudiencePayload
represents an audience who is watching the stream.
This payload might not be the up to date. (For example, some streaming platforms does not provider avatar URL when a chat message is sent via API connection.) If the client wants to update the UI or database later with the latest data, it should also request audienceUpdate
data type. For more information, see here.
- TypeScript
- C#
type AudiencePayload = {
id: string
username?: StringContentPayload
avatar?: ImageContentPayload
level: number
badges: BadgePayload[]
isModerator: boolean
isMember: boolean
}
struct AudiencePayload
{
public string Id;
public StringContentPayload? Username;
public ImageContentPayload? Avatar;
public int Level;
public BadgePayload[] Badges;
public bool IsModerator;
public bool IsMember;
}
SKU
The SkuPayload
represents a SKU that can be purchased.
- TypeScript
- C#
type SkuPayload = {
id: string
displayName: StringContentPayload
image?: ImageContentPayload
amount: number
currency: string
level: number
}
struct SkuPayload
{
public string Id;
public StringContentPayload DisplayName;
public ImageContentPayload? Image;
public float Amount;
public string Currency;
public int Level;
}
Emote
The EmotePayload
represents an emote that can be used in chat. It is usually displayed inline in the chat message.
The client should replace the matching emote keyword in a message with the emote image if possible.
- TypeScript
- C#
type EmotePayload = {
id: string
keyword: string
image: ImageContentPayload
}
struct EmotePayload
{
public string Id;
public string Keyword;
public ImageContentPayload Image;
}