This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
VTV_endpoints.js
160 lines (155 loc) · 5.46 KB
/
VTV_endpoints.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// GET /v5.0/vtvChannels/{vtv_channel_id}/now
// Requires signed in
Response = {
"programs": [
{
// Previous program...
},
{
"id": 123456789,
"vtv_channel_id": 3456789012,
"title": "Hearts Don't Break Around Here",
"tag": "EDM",
"tag_color": "998822FF", // RGBA Hex
"start_at": 1507904400000, // Milliseconds from Epoch
"end_at": 1507909800000, // Milliseconds from Epoch
"content_type": "collection",
"source_id": 5678901234, // Related to "content_type"
"vj": {
"id": 7890123456,
"full_name": "Cameron Wansley",
"username": "camjameson",
"profile_photo": {
"uri": "https://berserker3.vibbidi-vid.com/vibbidi-us/pictures/avatars/884794825109090.jpg"
}
},
"description": "In Disposable Macus Houses. These Zoopanktoo Filter the Ocean",
"videos": [
{
// Previous video...
},
{
"id": 6789012345,
"title": "Always On Your Side",
"artist": "Sheryl Crow",
"cover_image": {
"uri": "https://berserker4.vibbidi-vid.com/vibbidi/videos/video___KPCJV-o5BWA.mp4.bgcover.jpg"
},
"uri": "https://berserker4.vibbidi-vid.com/vibbidi/videos/video___KPCJV-o5BWA.mp4",
"duration": 147.05,
"mime_type": "video/mp4",
"width": 320,
"height": 240,
"size": 3594662,
"integrated_loudness": -12.8,
"player_audio_volume": 0.6918309709189365,
"start_point": 0.0, // Based on "duration"
"end_point": 147.05, // Based on "duration"
"start_at": 1507908007000, // Milliseconds from Epoch
"end_at": 1507908154050, // Milliseconds from Epoch
},
{
// Next video...
}
]
},
{
// Next program...
}
],
"n_watching": 11275,
"friends": [
{
"id": 7890123456,
"full_name": "Cameron Wansley",
"username": "camjameson",
"profile_photo": {
"uri": "https://berserker3.vibbidi-vid.com/vibbidi-us/pictures/avatars/884794825109090.jpg"
}
},
{
// Other friends...
}
]
}
// GET /v5.0/vtvChannels/{vtv_channel_id}/onlineUsers?onlyFriends=0&start_point=0&items_to_get=20
// Requires signed in
// Query param: onlyFriends = 0 (all users) or = 1 (only friends)
Response = {
"users": [
{
"id": 7890123456,
"full_name": "Cameron Wansley",
"username": "camjameson",
"profile_photo": {
"uri": "https://berserker3.vibbidi-vid.com/vibbidi-us/pictures/avatars/884794825109090.jpg"
}
},
{
// Other users...
}
],
"scrolling": {
"start_point": 0,
"items": 18
}
}
// POST /v5.0/vtvChannels/{vtv_channel_id}/comments
// Requires signed in
// Form/JSON params:
// "message": text, at most 128 characters, no new-line
Response = {
"success": true
}
// -----------------------
// Connect to WebSocket:
// Dial to /v4.1/webSocket, e.g. ws://v4-api.vibbidi.com:8018/v4.1/webSocket
// To authorize using request header, make sure there is Authorization field (BEARER xxx)
// Be ready to receive JSON messages in raw text from WebSocket
// Authorize using WebSocket, only when client hasn't authorized using header, client sends token ASAP
Payload = {
"seq": 1,
"action": "authentication_challenge",
"data": {
"token": "xxx" // Only token, no "BEARER"
}
}
// If token is OK, client will receive
Event = {
"status": "OK",
"seq_reply": 1
}
// If token isn't OK, there is no reply, WebSocket connection will close ASAP. To check connection health, see "ping" below.
// 1: Send
{
"action": "ping",
"seq": 334
}
// 1: Receive
{
"status": "OK", // OK or FAIL
"seq_reply": 334, // Match client sequence
"data": { // This field depends on action type, sometime "data" is omitted
"server_time": 1493136693404,
"text": "pong",
"version": "4.1.1"
}
}
// On WebSocket
// When there is a new comment
Event = {
"event": "vtv_comment_posted",
"data": {
"vtv_channel_id": 123456789,
"comment_id": 3456789012,
"message": "What the hell... :goberserk:", // emoji name is wrapped in colons
"importance": 1045.4, // 64-bit float, higher is more important
"sent_at": 1507908024000, // Milliseconds from Epoch
"size": 1.0, // 1.0 = 100%
"color": "", // Empty means default, otherwise RGBA Hex
"direction": 180.0, // Zero: Left to right, 90: bottom to top, 180: right to left, 270: top to bottom,...
"duration": 3.5, // The duration which it appears on screen
"avatar_uri": "https://berserker3.vibbidi-vid.com/vibbidi-us/pictures/avatars/884794825109090.jpg"
},
"sequence": 2345 // Server sequence (differentiate events), integer, 0 <= x < 2^63
}