1 | // Dependencies |
||
2 | const Listener = require( 'Listener' ); |
||
0 ignored issues
–
show
Backwards Compatibility
introduced
by
![]() |
|||
3 | |||
4 | var logger; |
||
5 | |||
6 | class Video |
||
0 ignored issues
–
show
|
|||
7 | { |
||
8 | constructor( name, deps ) |
||
9 | { |
||
10 | logger = deps.logger; |
||
11 | logger.info( "Loaded Cockpit Plugin: Video" ); |
||
12 | |||
13 | this.globalBus = deps.globalEventLoop; |
||
14 | this.cockpitBus = deps.cockpit; |
||
15 | this.cameras = {}; |
||
16 | |||
17 | this.listeners = |
||
18 | { |
||
19 | // TODO: Rename event |
||
20 | streamRegistration: new Listener( this.globalBus, 'CameraRegistration', false, (data) => |
||
0 ignored issues
–
show
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: ![]() |
|||
21 | { |
||
22 | // Re-emit on cockpit bus |
||
23 | this.cockpitBus.emit( 'CameraRegistration', data ); |
||
24 | }) |
||
25 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
26 | } |
||
27 | |||
28 | start() |
||
29 | { |
||
30 | // Set up listeners |
||
31 | this.listeners.streamRegistration.enable(); |
||
32 | } |
||
33 | |||
34 | stop() |
||
35 | { |
||
36 | this.listeners.streamRegistration.disable(); |
||
37 | } |
||
38 | |||
39 | getSettingSchema() |
||
40 | { |
||
41 | return [ |
||
42 | { |
||
43 | 'title': 'Cameras & Video', |
||
44 | 'category' : 'video', |
||
45 | 'id': 'videosettings', |
||
46 | 'type': 'object', |
||
47 | 'properties': |
||
48 | { |
||
49 | 'show-stats': |
||
50 | { |
||
51 | 'title': 'Show video player statistics', |
||
52 | 'description': 'Overlays real-time data about the video on top of the video feed. Does not affect your recorded or streaming video feed.', |
||
53 | 'id': 'show-stats', |
||
54 | 'type': 'boolean', |
||
55 | 'default': false |
||
56 | }, |
||
57 | 'use-geoserve': |
||
58 | { |
||
59 | 'title': 'Enabled the experimental raw H264 stream', |
||
60 | 'description': 'This only works for the beta clients. The current web client needs to have this feature disabled.', |
||
61 | 'id': 'use-geoserve', |
||
62 | 'type': 'boolean', |
||
63 | 'default': false |
||
64 | } |
||
65 | |||
66 | } |
||
67 | }]; |
||
68 | } |
||
69 | } |
||
70 | |||
71 | module.exports = function( name, deps ) |
||
72 | { |
||
73 | return new Video( name, deps ); |
||
74 | }; |