This repository was archived by the owner on Apr 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconfiguration-schema.js
More file actions
445 lines (442 loc) · 13.2 KB
/
configuration-schema.js
File metadata and controls
445 lines (442 loc) · 13.2 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
const streamSchema = {
hls: {
type: 'string',
description: 'URL of the HLS video stream.',
},
hd: {
type: 'string',
description: 'URL of the HD video stream.',
},
sd: {
type: 'string',
description: 'URL of the SD video stream.',
},
poster: {
type: 'string',
description: 'URL of the poster image.',
},
muted: {
type: 'boolean',
description: 'Mutes the audio stream of the video.',
default: false,
},
};
const stateSchema = {
playState: {
type: 'string',
options: ['PLAYING', 'PAUSED'],
default: 'PAUSED',
},
position: {
type: 'number',
default: 0,
description: 'Video position in seconds.',
},
playbackRate: {
type: 'number',
options: [0.7, 1.0, 1.3, 1.5, 1.8, 2.0],
default: 1,
},
quality: {
type: 'string',
options: ['hls', 'hd', 'sd'],
default: 'best quality available',
},
volume: {
type: 'number',
min: 0,
max: 1,
default: 1,
},
muted: {
type: 'boolean',
default: false,
},
captionLanguage: {
type: 'string',
default: 'off',
},
captionType: {
type: 'string',
default: 'default',
},
showCaptions: {
type: 'boolean',
default: false,
description: 'Enables captions. Additionally, `captionLanguage` needs to be set.',
},
showInteractiveTranscript: {
type: 'boolean',
default: false,
description: 'Enables interactive transcript. Additionally, `captionLanguage` needs to be set.',
},
resizerRatios: {
type: 'array',
description: 'The ratios of the resizers. Ratio is calculated by `leftVideo.width / rightVideo.width`. Per default, videos were aligned to have the same height.',
},
};
export const configurationSchema = {
streams: {
required: true,
type: 'array',
description: 'List of URLs to the videos streams of different qualities and (optional) poster images. If there is only one quality, use `hd`.',
schema: streamSchema,
example: [
{
sd: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
hd: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
poster: 'https://peach.blender.org/wp-content/uploads/bbb-splash.png',
},
],
},
fallbackStream: {
type: 'object',
description: 'Contains a fallback stream that the user can switch to, i.e. a single stream source.',
schema: streamSchema,
},
language: {
type: 'string',
default: 'en',
description: 'Language used for localizing messages.',
},
initialState: {
type: 'object',
description: 'The initial state the player has when loaded.',
schema: stateSchema,
},
userPreferences: {
type: 'object',
schema: stateSchema,
description: 'Override parts of the default/initial/saved state. Meant to be provided by the server based on the current user.',
},
foregroundColor: {
type: 'string',
pattern: /^#(?:[0-9a-f]{3}){1,2}$/i,
description: 'HEX code of the color for text and all other main content.',
},
accentColor: {
type: 'string',
pattern: /^#(?:[0-9a-f]{3}){1,2}$/i,
description: 'HEX code of the highlighting color.',
},
fontColorOnAccentColor: {
type: 'string',
pattern: /^#(?:[0-9a-f]{3}){1,2}$/i,
description: 'HEX code of the font color on the `accentColor`. Take care that the contrast ratio is high enough.',
},
backgroundColor: {
type: 'string',
pattern: /^#(?:[0-9a-f]{3}){1,2}$/i,
description: 'HEX code of the background for the `foregroundColor`.',
},
secondaryBackgroundColor: {
type: 'string',
pattern: /^#(?:[0-9a-f]{3}){1,2}$/i,
description: 'HEX code of another background color used for example for displaying the buffer. Take care that the `foregroundColor` has a high contrast to both background colors.',
},
theme: {
type: 'string',
options: ['dark-orange', 'dark-yellow', 'dark-blue', 'light-green', 'dark-red', 'light-red'],
default: 'dark-orange',
description: 'Predefined color theme (can be adjusted by settings the colors explicitly).',
},
videoPreload: {
type: 'boolean',
default: true,
description: 'Turns on/off preloading of the videos when the page loads.',
},
trimVideo: {
type: 'object',
description: 'Restricts the playback on a specific segment of the video.',
schema: {
start: {
type: 'number',
default: 0,
description: 'The start position of the segment.',
},
end: {
type: 'number',
default: 'duration of video',
description: 'The end position of the segment',
},
},
example: {
start: 60,
end: 300,
},
},
chapters: {
type: 'array',
description: 'List of timestamps with chapter names.',
schema: {
title: {
required: true,
type: 'string',
description: 'Title of the chapter.',
},
startPosition: {
required: true,
type: 'number',
description: 'Start position of the chapter in seconds.',
},
},
example: [
{
title: 'Chapter 1',
startPosition: 0,
},
],
},
captions: {
type: 'array',
description: 'List of caption files for different languages.',
schema: {
name: {
type: 'string',
description: 'Name of the captions that is shown in the drop-down control.',
},
language: {
required: true,
type: 'string',
description: 'Language code of the captions.',
},
url: {
required: true,
type: 'string',
description: 'URL of the captions WebVTT file.',
},
type: {
type: 'string',
description: 'Determines the type of captions. Currently, `default` and `auto-generated` are supported.',
default: 'default',
},
},
example: [
{
language: 'en',
url: '/captions/en.vtt',
},
],
},
slides: {
type: 'array',
description: 'List of presentation slides and corresponding start times in seconds to show below the progress.',
schema: {
thumbnail: {
required: true,
type: 'string',
description: 'URL of the slide thumbnail.',
},
startPosition: {
required: true,
type: 'number',
description: 'Start position of the slide in seconds.',
},
},
example: [
{
thumbnail: '/image/of/slide.jpg',
startPosition: 0,
},
],
},
quiz: {
type: 'object',
description: 'Information for the quiz component of the player.',
schema: {
validationCallback: {
required: true,
type: 'string',
description: 'Name of a global function that is called by the handler to validate user answers for the questions. It will be passed the question that is currently shown as first parameter. The second parameter depends on the question type. For text questions, this will be the text the user entered. For choice questions, the second parameter will be a list of all answer objects that are associated with this question and were selected by the user. The function should return an object that has two attributes, `isAnswerCorrect` and `correctAnswers`. The first, a boolean, indicates whether anything was wrong. The second, a list containing a subset of the answers stored with this question, is used to show the user where he made mistakes or to show him what possible answers could have been.',
},
questions: {
type: 'array',
required: true,
description: 'List of questions that are shown to the user during playback.',
schema: {
id: {
required: true,
type: 'number',
description: 'The id for this question. This is primarily intended to be stored for the validation callback.',
},
text: {
required: true,
type: 'string',
description: 'The question text that is shown to the user.',
},
type: {
required: true,
type: 'string',
description: 'The questions type. Should be `single-choice`, `multiple-choice` or `freetext`.',
},
position: {
required: true,
type: 'number',
description: 'The point in the video where the question should be shown, in seconds.',
},
answers: {
type: 'array',
description: 'A list of possible answers for `single-choice` or `multiple-choice` questions.',
schema: {
id: {
required: true,
type: 'number',
description: 'The id for this answer. This is primarily intended to be stored for the validation callback.',
},
text: {
required: true,
type: 'string',
description: 'The text of this answer.',
},
},
},
},
example: [
{
id: 1,
text: 'What is HTML?',
type: 'single-choice',
position: 3600,
answers: [
{
id: 1,
text: 'A standard internet protocol for information exchange.',
},
{
id: 2,
text: 'A markup language for creating web sites.',
},
{
id: 3,
text: 'A program used to download files to your computer',
},
],
},
],
},
},
},
relatedVideos: {
type: 'array',
description: 'List of related videos that are shown after the video has ended.',
schema: {
title: {
required: true,
type: 'string',
description: 'Title of the video.',
},
url: {
required: true,
type: 'string',
description: 'URL of the video page.',
},
thumbnail: {
required: true,
type: 'string',
description: 'URL of the video thumbnail.',
},
duration: {
type: 'number',
description: 'Duration of the video in seconds.',
},
},
example: [
{
title: 'Title of related video.',
url: '/url/of/video-page',
thumbnail: '/image/of/thumbnail.jpg',
duration: 2259,
},
],
},
playlist: {
type: 'object',
description: 'The playlist, the video is part of.',
schema: {
autoPlay: {
type: 'boolean',
description: 'If enabled, the user is redirected to the next video page after the video has ended.',
default: false,
},
hideInList: {
type: 'boolean',
description: 'If enabled, the playlist entries are not shown in the playlist/chapter list.',
default: false,
},
currentPosition: {
required: true,
type: 'number',
description: 'The current position in the playlist.',
},
entries: {
required: true,
type: 'array',
description: 'Videos of the playlist.',
schema: {
title: {
type: 'string',
description: 'The title of the video.',
},
url: {
required: true,
type: 'string',
description: 'The url of the page containing the video.',
},
},
},
},
example: {
autoPlay: true,
currentPosition: 1,
entries: [
{
title: 'Previous Video',
url: '/url/of/previous/video',
},
{
title: 'Current Video',
url: '/url/of/current/video',
},
{
title: 'Next Video',
url: '/url/of/next/video',
},
],
},
},
videoObject: {
type: 'object',
description: 'Video metadata defined in the [VideoObject](http://schema.org/VideoObject) schema as JSON-LD, which is rendered by the player.',
example: {
'@context': 'http://schema.org/',
'@type': 'VideoObject',
name: 'Name of the video',
duration: 'Duration of the video',
},
},
liveDvr: {
type: 'boolean',
description: 'If given stream is a live stream that supports DVR, this flag must be enabled to make seeking possible.',
default: false,
},
positionInUrlFragment: {
type: 'boolean',
description: 'If enabled, the initial video position is read from the URL fragment parameter `t` (e.g. `#t=25`).',
default: false,
},
mobileMenu: {
type: 'boolean',
description: 'If disabled, the control bar icons are forced to be shown inline instead of being part of a separated mobile menu. This might cause the control bar content to overflow, if there are two much controls!',
default: true,
},
noteApi: {
type: 'string',
description: 'Name of a global object that is used to communicate marker and note changes. See notes.md for more information.',
default: '',
},
downloadUri: {
type: 'string',
description: 'Uri that can be used to download a file for the current video. If set, a download button will be shown which is has this uri set as target location. If you want to trigger a file download, make sure you have the content disposition on that url set correctly.',
default: '',
},
};