proctoring 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +245 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/config/100ms_manifest.js +1 -0
  6. data/app/assets/config/knights_watch_manifest.js +4 -0
  7. data/app/assets/config/kurento_manifest.js +1 -0
  8. data/app/assets/config/proctoring_manifest.js +3 -0
  9. data/app/assets/config/videojs_manifest.js +2 -0
  10. data/app/assets/images/proctoring/poster.png +0 -0
  11. data/app/assets/javascripts/100ms/examine.js +27 -0
  12. data/app/assets/javascripts/100ms/hundred_ms.js +143 -0
  13. data/app/assets/javascripts/100ms/join_proctor_room.js +17 -0
  14. data/app/assets/javascripts/100ms/proctor.js +152 -0
  15. data/app/assets/javascripts/kurento/LiveVideoUsingSignalingServer.js +344 -0
  16. data/app/assets/javascripts/kurento/VideoPlayer.js +63 -0
  17. data/app/assets/javascripts/kurento/VideoRecording.js +286 -0
  18. data/app/assets/javascripts/kurento/VideoRecordingUsingSignalingServer.js +224 -0
  19. data/app/assets/javascripts/kurento/co.js +299 -0
  20. data/app/assets/javascripts/kurento/kurento-utils.js +4418 -0
  21. data/app/assets/javascripts/proctoring/stream_channel.js +66 -0
  22. data/app/assets/javascripts/proctoring/stream_room.js +131 -0
  23. data/app/assets/javascripts/proctoring/video_recorder.js +172 -0
  24. data/app/assets/javascripts/videojs/videojs-playlist-ui.js +516 -0
  25. data/app/assets/javascripts/videojs/videojs-playlist.js +909 -0
  26. data/app/assets/stylesheets/proctoring/application.css +15 -0
  27. data/app/assets/stylesheets/proctoring/video_player_100ms.css +34 -0
  28. data/app/assets/stylesheets/proctoring/video_streamings.css +49 -0
  29. data/app/assets/stylesheets/scaffold.css +80 -0
  30. data/app/assets/stylesheets/videojs/videojs-playlist-ui.css +1 -0
  31. data/app/controllers/proctoring/api/v1/authentication_controller.rb +31 -0
  32. data/app/controllers/proctoring/api/v1/hundred_ms/services_controller.rb +24 -0
  33. data/app/controllers/proctoring/application_controller.rb +23 -0
  34. data/app/controllers/proctoring/video_streamings_controller.rb +108 -0
  35. data/app/helpers/proctoring/application_helper.rb +4 -0
  36. data/app/helpers/proctoring/hundred_ms_service_helper.rb +90 -0
  37. data/app/helpers/proctoring/tokens_helper.rb +55 -0
  38. data/app/helpers/proctoring/video_streamings_helper.rb +4 -0
  39. data/app/jobs/proctoring/application_job.rb +4 -0
  40. data/app/mailers/proctoring/application_mailer.rb +6 -0
  41. data/app/models/proctoring/application_record.rb +5 -0
  42. data/app/models/proctoring/video_streaming.rb +54 -0
  43. data/app/models/proctoring/video_streaming_room.rb +29 -0
  44. data/app/views/layouts/proctoring/application.html.erb +15 -0
  45. data/app/views/proctoring/video_player/live_video_proctoring.html.erb +84 -0
  46. data/app/views/proctoring/video_player/live_video_proctoring_100ms.html.erb +48 -0
  47. data/app/views/proctoring/video_player/video_player.html.erb +40 -0
  48. data/app/views/proctoring/video_streamings/_form.html.erb +27 -0
  49. data/app/views/proctoring/video_streamings/_list.html.erb +27 -0
  50. data/app/views/proctoring/video_streamings/_record_video_from_client.html.erb +8 -0
  51. data/app/views/proctoring/video_streamings/_socket_rtc_scripts.html.erb +5 -0
  52. data/app/views/proctoring/video_streamings/_stream_video.html.erb +8 -0
  53. data/app/views/proctoring/video_streamings/_video_recording.html.erb +3 -0
  54. data/app/views/proctoring/video_streamings/_video_recording100ms.html.erb +4 -0
  55. data/app/views/proctoring/video_streamings/distribute_channel_to_rooms.html.erb +39 -0
  56. data/app/views/proctoring/video_streamings/edit.html.erb +6 -0
  57. data/app/views/proctoring/video_streamings/event.html.erb +9 -0
  58. data/app/views/proctoring/video_streamings/index.html.erb +1 -0
  59. data/app/views/proctoring/video_streamings/new.html.erb +5 -0
  60. data/app/views/proctoring/video_streamings/show.html.erb +19 -0
  61. data/app/views/proctoring/video_streamings/stream_channel.html.erb +1 -0
  62. data/app/views/proctoring/video_streamings/stream_room.html.erb +1 -0
  63. data/config/routes.rb +24 -0
  64. data/db/migrate/20200526061313_create_proctoring_video_streamings.rb +15 -0
  65. data/db/migrate/20200527045158_create_proctoring_video_streaming_rooms.rb +13 -0
  66. data/lib/proctoring/engine.rb +41 -0
  67. data/lib/proctoring/version.rb +3 -0
  68. data/lib/proctoring.rb +5 -0
  69. data/lib/tasks/proctoring_tasks.rake +4 -0
  70. metadata +158 -0
@@ -0,0 +1,516 @@
1
+ /*! @name videojs-playlist-ui @version 3.8.0 @license Apache-2.0 */
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/document'), require('video.js')) :
4
+ typeof define === 'function' && define.amd ? define(['global/document', 'video.js'], factory) :
5
+ (global.videojsPlaylistUi = factory(global.document,global.videojs));
6
+ }(this, (function (document,videojs) { 'use strict';
7
+
8
+ document = document && document.hasOwnProperty('default') ? document['default'] : document;
9
+ videojs = videojs && videojs.hasOwnProperty('default') ? videojs['default'] : videojs;
10
+
11
+ function _inheritsLoose(subClass, superClass) {
12
+ subClass.prototype = Object.create(superClass.prototype);
13
+ subClass.prototype.constructor = subClass;
14
+ subClass.__proto__ = superClass;
15
+ }
16
+
17
+ var version = "3.8.0";
18
+
19
+ var dom = videojs.dom || videojs;
20
+ var registerPlugin = videojs.registerPlugin || videojs.plugin; // Array#indexOf analog for IE8
21
+
22
+ var indexOf = function indexOf(array, target) {
23
+ for (var i = 0, length = array.length; i < length; i++) {
24
+ if (array[i] === target) {
25
+ return i;
26
+ }
27
+ }
28
+
29
+ return -1;
30
+ }; // see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/pointerevents.js
31
+
32
+
33
+ var supportsCssPointerEvents = function () {
34
+ var element = document.createElement('x');
35
+ element.style.cssText = 'pointer-events:auto';
36
+ return element.style.pointerEvents === 'auto';
37
+ }();
38
+
39
+ var defaults = {
40
+ className: 'vjs-playlist',
41
+ playOnSelect: false,
42
+ supportsCssPointerEvents: supportsCssPointerEvents
43
+ }; // we don't add `vjs-playlist-now-playing` in addSelectedClass
44
+ // so it won't conflict with `vjs-icon-play
45
+ // since it'll get added when we mouse out
46
+
47
+ var addSelectedClass = function addSelectedClass(el) {
48
+ el.addClass('vjs-selected');
49
+ };
50
+
51
+ var removeSelectedClass = function removeSelectedClass(el) {
52
+ el.removeClass('vjs-selected');
53
+
54
+ if (el.thumbnail) {
55
+ dom.removeClass(el.thumbnail, 'vjs-playlist-now-playing');
56
+ }
57
+ };
58
+
59
+ var upNext = function upNext(el) {
60
+ el.addClass('vjs-up-next');
61
+ };
62
+
63
+ var notUpNext = function notUpNext(el) {
64
+ el.removeClass('vjs-up-next');
65
+ };
66
+
67
+ var createThumbnail = function createThumbnail(thumbnail) {
68
+ if (!thumbnail) {
69
+ var placeholder = document.createElement('div');
70
+ placeholder.className = 'vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder';
71
+ return placeholder;
72
+ }
73
+
74
+ var picture = document.createElement('picture');
75
+ picture.className = 'vjs-playlist-thumbnail';
76
+
77
+ if (typeof thumbnail === 'string') {
78
+ // simple thumbnails
79
+ var img = document.createElement('img');
80
+ img.src = thumbnail;
81
+ img.alt = '';
82
+ picture.appendChild(img);
83
+ } else {
84
+ // responsive thumbnails
85
+ // additional variations of a <picture> are specified as
86
+ // <source> elements
87
+ for (var i = 0; i < thumbnail.length - 1; i++) {
88
+ var _variant = thumbnail[i];
89
+ var source = document.createElement('source'); // transfer the properties of each variant onto a <source>
90
+
91
+ for (var prop in _variant) {
92
+ source[prop] = _variant[prop];
93
+ }
94
+
95
+ picture.appendChild(source);
96
+ } // the default version of a <picture> is specified by an <img>
97
+
98
+
99
+ var variant = thumbnail[thumbnail.length - 1];
100
+
101
+ var _img = document.createElement('img');
102
+
103
+ _img.alt = '';
104
+
105
+ for (var _prop in variant) {
106
+ _img[_prop] = variant[_prop];
107
+ }
108
+
109
+ picture.appendChild(_img);
110
+ }
111
+
112
+ return picture;
113
+ };
114
+
115
+ var Component = videojs.getComponent('Component');
116
+
117
+ var PlaylistMenuItem = /*#__PURE__*/function (_Component) {
118
+ _inheritsLoose(PlaylistMenuItem, _Component);
119
+
120
+ function PlaylistMenuItem(player, playlistItem, settings) {
121
+ var _this;
122
+
123
+ if (!playlistItem.item) {
124
+ throw new Error('Cannot construct a PlaylistMenuItem without an item option');
125
+ }
126
+
127
+ playlistItem.showDescription = settings.showDescription;
128
+ _this = _Component.call(this, player, playlistItem) || this;
129
+ _this.item = playlistItem.item;
130
+ _this.playOnSelect = settings.playOnSelect;
131
+
132
+ _this.emitTapEvents();
133
+
134
+ _this.on(['click', 'tap'], _this.switchPlaylistItem_);
135
+
136
+ _this.on('keydown', _this.handleKeyDown_);
137
+
138
+ return _this;
139
+ }
140
+
141
+ var _proto = PlaylistMenuItem.prototype;
142
+
143
+ _proto.handleKeyDown_ = function handleKeyDown_(event) {
144
+ // keycode 13 is <Enter>
145
+ // keycode 32 is <Space>
146
+ if (event.which === 13 || event.which === 32) {
147
+ this.switchPlaylistItem_();
148
+ }
149
+ };
150
+
151
+ _proto.switchPlaylistItem_ = function switchPlaylistItem_(event) {
152
+ this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item));
153
+
154
+ if (this.playOnSelect) {
155
+ this.player_.play();
156
+ }
157
+ };
158
+
159
+ _proto.createEl = function createEl() {
160
+ var li = document.createElement('li');
161
+ var item = this.options_.item;
162
+ var showDescription = this.options_.showDescription;
163
+
164
+ if (typeof item.data === 'object') {
165
+ var dataKeys = Object.keys(item.data);
166
+ dataKeys.forEach(function (key) {
167
+ var value = item.data[key];
168
+ li.dataset[key] = value;
169
+ });
170
+ }
171
+
172
+ li.className = 'vjs-playlist-item';
173
+ li.setAttribute('tabIndex', 0); // Thumbnail image
174
+
175
+ this.thumbnail = createThumbnail(item.thumbnail);
176
+ li.appendChild(this.thumbnail); // Duration
177
+
178
+ if (item.duration) {
179
+ var duration = document.createElement('time');
180
+ var time = videojs.formatTime(item.duration);
181
+ duration.className = 'vjs-playlist-duration';
182
+ duration.setAttribute('datetime', 'PT0H0M' + item.duration + 'S');
183
+ duration.appendChild(document.createTextNode(time));
184
+ li.appendChild(duration);
185
+ } // Now playing
186
+
187
+
188
+ var nowPlayingEl = document.createElement('span');
189
+ var nowPlayingText = this.localize('Now Playing');
190
+ nowPlayingEl.className = 'vjs-playlist-now-playing-text';
191
+ nowPlayingEl.appendChild(document.createTextNode(nowPlayingText));
192
+ nowPlayingEl.setAttribute('title', nowPlayingText);
193
+ this.thumbnail.appendChild(nowPlayingEl); // Title container contains title and "up next"
194
+
195
+ var titleContainerEl = document.createElement('div');
196
+ titleContainerEl.className = 'vjs-playlist-title-container';
197
+ this.thumbnail.appendChild(titleContainerEl); // Up next
198
+
199
+ var upNextEl = document.createElement('span');
200
+ var upNextText = this.localize('Up Next');
201
+ upNextEl.className = 'vjs-up-next-text';
202
+ upNextEl.appendChild(document.createTextNode(upNextText));
203
+ upNextEl.setAttribute('title', upNextText);
204
+ titleContainerEl.appendChild(upNextEl); // Video title
205
+
206
+ var titleEl = document.createElement('cite');
207
+ var titleText = item.name || this.localize('Untitled Video');
208
+ titleEl.className = 'vjs-playlist-name';
209
+ titleEl.appendChild(document.createTextNode(titleText));
210
+ titleEl.setAttribute('title', titleText);
211
+ titleContainerEl.appendChild(titleEl); // We add thumbnail video description only if specified in playlist options
212
+
213
+ if (showDescription) {
214
+ var descriptionEl = document.createElement('div');
215
+ var descriptionText = item.description || '';
216
+ descriptionEl.className = 'vjs-playlist-description';
217
+ descriptionEl.appendChild(document.createTextNode(descriptionText));
218
+ descriptionEl.setAttribute('title', descriptionText);
219
+ titleContainerEl.appendChild(descriptionEl);
220
+ }
221
+
222
+ return li;
223
+ };
224
+
225
+ return PlaylistMenuItem;
226
+ }(Component);
227
+
228
+ var PlaylistMenu = /*#__PURE__*/function (_Component2) {
229
+ _inheritsLoose(PlaylistMenu, _Component2);
230
+
231
+ function PlaylistMenu(player, options) {
232
+ var _this2;
233
+
234
+ if (!player.playlist) {
235
+ throw new Error('videojs-playlist is required for the playlist component');
236
+ }
237
+
238
+ _this2 = _Component2.call(this, player, options) || this;
239
+ _this2.items = [];
240
+
241
+ if (options.horizontal) {
242
+ _this2.addClass('vjs-playlist-horizontal');
243
+ } else {
244
+ _this2.addClass('vjs-playlist-vertical');
245
+ } // If CSS pointer events aren't supported, we have to prevent
246
+ // clicking on playlist items during ads with slightly more
247
+ // invasive techniques. Details in the stylesheet.
248
+
249
+
250
+ if (options.supportsCssPointerEvents) {
251
+ _this2.addClass('vjs-csspointerevents');
252
+ }
253
+
254
+ _this2.createPlaylist_();
255
+
256
+ if (!videojs.browser.TOUCH_ENABLED) {
257
+ _this2.addClass('vjs-mouse');
258
+ }
259
+
260
+ _this2.on(player, ['loadstart', 'playlistchange', 'playlistsorted'], function (event) {
261
+ _this2.update();
262
+ }); // Keep track of whether an ad is playing so that the menu
263
+ // appearance can be adapted appropriately
264
+
265
+
266
+ _this2.on(player, 'adstart', function () {
267
+ _this2.addClass('vjs-ad-playing');
268
+ });
269
+
270
+ _this2.on(player, 'adend', function () {
271
+ _this2.removeClass('vjs-ad-playing');
272
+ });
273
+
274
+ _this2.on('dispose', function () {
275
+ _this2.empty_();
276
+
277
+ player.playlistMenu = null;
278
+ });
279
+
280
+ _this2.on(player, 'dispose', function () {
281
+ _this2.dispose();
282
+ });
283
+
284
+ return _this2;
285
+ }
286
+
287
+ var _proto2 = PlaylistMenu.prototype;
288
+
289
+ _proto2.createEl = function createEl() {
290
+ return dom.createEl('div', {
291
+ className: this.options_.className
292
+ });
293
+ };
294
+
295
+ _proto2.empty_ = function empty_() {
296
+ if (this.items && this.items.length) {
297
+ this.items.forEach(function (i) {
298
+ return i.dispose();
299
+ });
300
+ this.items.length = 0;
301
+ }
302
+ };
303
+
304
+ _proto2.createPlaylist_ = function createPlaylist_() {
305
+ var playlist = this.player_.playlist() || [];
306
+ var list = this.el_.querySelector('.vjs-playlist-item-list');
307
+ var overlay = this.el_.querySelector('.vjs-playlist-ad-overlay');
308
+
309
+ if (!list) {
310
+ list = document.createElement('ol');
311
+ list.className = 'vjs-playlist-item-list';
312
+ this.el_.appendChild(list);
313
+ }
314
+
315
+ this.empty_(); // create new items
316
+
317
+ for (var i = 0; i < playlist.length; i++) {
318
+ var item = new PlaylistMenuItem(this.player_, {
319
+ item: playlist[i]
320
+ }, this.options_);
321
+ this.items.push(item);
322
+ list.appendChild(item.el_);
323
+ } // Inject the ad overlay. IE<11 doesn't support "pointer-events:
324
+ // none" so we use this element to block clicks during ad
325
+ // playback.
326
+
327
+
328
+ if (!overlay) {
329
+ overlay = document.createElement('li');
330
+ overlay.className = 'vjs-playlist-ad-overlay';
331
+ list.appendChild(overlay);
332
+ } else {
333
+ // Move overlay to end of list
334
+ list.appendChild(overlay);
335
+ } // select the current playlist item
336
+
337
+
338
+ var selectedIndex = this.player_.playlist.currentItem();
339
+
340
+ if (this.items.length && selectedIndex >= 0) {
341
+ addSelectedClass(this.items[selectedIndex]);
342
+ var thumbnail = this.items[selectedIndex].$('.vjs-playlist-thumbnail');
343
+
344
+ if (thumbnail) {
345
+ dom.addClass(thumbnail, 'vjs-playlist-now-playing');
346
+ }
347
+ }
348
+ };
349
+
350
+ _proto2.update = function update() {
351
+ // replace the playlist items being displayed, if necessary
352
+ var playlist = this.player_.playlist();
353
+
354
+ if (this.items.length !== playlist.length) {
355
+ // if the menu is currently empty or the state is obviously out
356
+ // of date, rebuild everything.
357
+ this.createPlaylist_();
358
+ return;
359
+ }
360
+
361
+ for (var i = 0; i < this.items.length; i++) {
362
+ if (this.items[i].item !== playlist[i]) {
363
+ // if any of the playlist items have changed, rebuild the
364
+ // entire playlist
365
+ this.createPlaylist_();
366
+ return;
367
+ }
368
+ } // the playlist itself is unchanged so just update the selection
369
+
370
+
371
+ var currentItem = this.player_.playlist.currentItem();
372
+
373
+ for (var _i = 0; _i < this.items.length; _i++) {
374
+ var item = this.items[_i];
375
+
376
+ if (_i === currentItem) {
377
+ addSelectedClass(item);
378
+
379
+ if (document.activeElement !== item.el()) {
380
+ dom.addClass(item.thumbnail, 'vjs-playlist-now-playing');
381
+ }
382
+
383
+ notUpNext(item);
384
+ } else if (_i === currentItem + 1) {
385
+ removeSelectedClass(item);
386
+ upNext(item);
387
+ } else {
388
+ removeSelectedClass(item);
389
+ notUpNext(item);
390
+ }
391
+ }
392
+ };
393
+
394
+ return PlaylistMenu;
395
+ }(Component);
396
+ /**
397
+ * Returns a boolean indicating whether an element has child elements.
398
+ *
399
+ * Note that this is distinct from whether it has child _nodes_.
400
+ *
401
+ * @param {HTMLElement} el
402
+ * A DOM element.
403
+ *
404
+ * @return {boolean}
405
+ * Whether the element has child elements.
406
+ */
407
+
408
+
409
+ var hasChildEls = function hasChildEls(el) {
410
+ for (var i = 0; i < el.childNodes.length; i++) {
411
+ if (dom.isEl(el.childNodes[i])) {
412
+ return true;
413
+ }
414
+ }
415
+
416
+ return false;
417
+ };
418
+ /**
419
+ * Finds the first empty root element.
420
+ *
421
+ * @param {string} className
422
+ * An HTML class name to search for.
423
+ *
424
+ * @return {HTMLElement}
425
+ * A DOM element to use as the root for a playlist.
426
+ */
427
+
428
+
429
+ var findRoot = function findRoot(className) {
430
+ var all = document.querySelectorAll('.' + className);
431
+ var el;
432
+
433
+ for (var i = 0; i < all.length; i++) {
434
+ if (!hasChildEls(all[i])) {
435
+ el = all[i];
436
+ break;
437
+ }
438
+ }
439
+
440
+ return el;
441
+ };
442
+ /**
443
+ * Initialize the plugin on a player.
444
+ *
445
+ * @param {Object} [options]
446
+ * An options object.
447
+ *
448
+ * @param {HTMLElement} [options.el]
449
+ * A DOM element to use as a root node for the playlist.
450
+ *
451
+ * @param {string} [options.className]
452
+ * An HTML class name to use to find a root node for the playlist.
453
+ *
454
+ * @param {boolean} [options.playOnSelect = false]
455
+ * If true, will attempt to begin playback upon selecting a new
456
+ * playlist item in the UI.
457
+ */
458
+
459
+
460
+ var playlistUi = function playlistUi(options) {
461
+ var player = this;
462
+
463
+ if (!player.playlist) {
464
+ throw new Error('videojs-playlist plugin is required by the videojs-playlist-ui plugin');
465
+ }
466
+
467
+ if (dom.isEl(options)) {
468
+ videojs.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!');
469
+ options = {
470
+ el: options
471
+ };
472
+ }
473
+
474
+ options = videojs.mergeOptions(defaults, options); // If the player is already using this plugin, remove the pre-existing
475
+ // PlaylistMenu, but retain the element and its location in the DOM because
476
+ // it will be re-used.
477
+
478
+ if (player.playlistMenu) {
479
+ var el = player.playlistMenu.el(); // Catch cases where the menu may have been disposed elsewhere or the
480
+ // element removed from the DOM.
481
+
482
+ if (el) {
483
+ var parentNode = el.parentNode;
484
+ var nextSibling = el.nextSibling; // Disposing the menu will remove `el` from the DOM, but we need to
485
+ // empty it ourselves to be sure.
486
+
487
+ player.playlistMenu.dispose();
488
+ dom.emptyEl(el); // Put the element back in its place.
489
+
490
+ if (nextSibling) {
491
+ parentNode.insertBefore(el, nextSibling);
492
+ } else {
493
+ parentNode.appendChild(el);
494
+ }
495
+
496
+ options.el = el;
497
+ }
498
+ }
499
+
500
+ if (!dom.isEl(options.el)) {
501
+ options.el = findRoot(options.className);
502
+ }
503
+
504
+ player.playlistMenu = new PlaylistMenu(player, options);
505
+ }; // register components
506
+
507
+
508
+ videojs.registerComponent('PlaylistMenu', PlaylistMenu);
509
+ videojs.registerComponent('PlaylistMenuItem', PlaylistMenuItem); // register the plugin
510
+
511
+ registerPlugin('playlistUi', playlistUi);
512
+ playlistUi.VERSION = version;
513
+
514
+ return playlistUi;
515
+
516
+ })));