Skip to content

Commit 8e2d43e

Browse files
committed
fix recordStatus for all device types
1 parent 64023c0 commit 8e2d43e

File tree

4 files changed

+67
-17
lines changed

4 files changed

+67
-17
lines changed

JS_Files/audio.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,19 @@ export class Audio {
5555
*
5656
* @return {string} - Device identifier used to describe device output
5757
*/
58-
getKind() {
58+
getKind() {
5959
return this.#kind;
6060
}
6161

62+
/**
63+
* Getter function to retrieve the device recording status based on video and audio
64+
*
65+
* @return {string} - Device identifier used to describe device recording status
66+
*/
67+
getRecordStatus() {
68+
return (this.#audioCheckbox.checked);
69+
}
70+
6271
monitorAudio(stream) {
6372
let max_level_L = 0;
6473
let old_level_L = 0;

JS_Files/camera.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export class Camera {
7070
*
7171
* @return {string} - Device identifier used to describe device recording status
7272
*/
73-
getRecordStatus() {
74-
return (this.#audioCheckbox.checked || this.#videoCheckbox.checked);
73+
getRecordStatus() {
74+
return (this.#audioCheckbox.checked || this.#videoCheckbox.checked);
7575
}
7676

7777

JS_Files/chronosense.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,11 @@ async function recordAllSelectedDevices() {
481481
})
482482
selectedDevices.forEach((device) => {
483483
// Checks whether or not Audio or Video is selected if not do not start
484-
if (device.getRecordStatus() == false) {
485-
console.log('Audio and Video are both off')
486-
}
487-
else {
488-
// Start recording
489-
device.setDirName(recordDirectory);
490-
device.startRecording();
491-
numRecording++;
484+
if (device.getRecordStatus()) {
485+
// Start recording
486+
device.setDirName(recordDirectory);
487+
device.startRecording();
488+
numRecording++;
492489
}
493490
});
494491
}

JS_Files/screen_capture_device.js

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ const remote = require('@electron/remote');
22
import { AVRecorder } from './avRecorder.js';
33

44
export class ScreenCaptureDevice {
5-
6-
#label = "Screen Capture";
7-
#deviceId = "ScreenCaptureModule";
5+
#deviceId = "ScreenCapture";
6+
#groupId = "ScreenCapture";
7+
#kind = "screencapture";
8+
#label = "ScreenCapture";
89
#videoElement = null;
910
#optionContainer = null;
1011
#sources = []
@@ -27,10 +28,51 @@ export class ScreenCaptureDevice {
2728
/**
2829
* Constructor for a ScreenCaptureDevice object that captures stream of video/audio from user screens & windows.
2930
*
31+
* @param {string} deviceId - Identifier for the device used in input capture.
32+
* @param {string} groupId - Identifier for the device group used in input capture.
33+
* @param {string} kind - Identifier for type of input from device.
34+
* @param {string} label - Name Identifier (Sensical to user for reading).
3035
*/
31-
constructor() {
32-
this.getCaptureSources();
33-
}
36+
constructor(deviceId, groupId, kind, label) {
37+
this.#deviceId = "ScreenCapture";
38+
this.#groupId = "ScreenCapture";
39+
this.#kind = "screencapture";
40+
this.#label = "ScreenCapture";
41+
42+
this.getCaptureSources();
43+
}
44+
45+
getPluginDiv() {
46+
let _pluginDiv = this.#pluginDiv;
47+
return _pluginDiv;
48+
}
49+
50+
/**
51+
* Getter function to retrieve the object's Group ID
52+
*
53+
* @return {string} - Group identifier used to connect it to other similar devices
54+
*/
55+
getGroupId() {
56+
return this.#groupId;
57+
}
58+
59+
/**
60+
* Getter function to retrieve the object's "kind"
61+
*
62+
* @return {string} - Device identifier used to describe device output
63+
*/
64+
getKind() {
65+
return this.#kind;
66+
}
67+
68+
/**
69+
* Getter function to retrieve the device recording status based on video and audio
70+
*
71+
* @return {string} - Device identifier used to describe device recording status
72+
*/
73+
getRecordStatus() {
74+
return (this.#videoCheckbox.checked);
75+
}
3476

3577
fixForMacOS() {
3678
if(process.platform === "darwin") {
@@ -46,6 +88,8 @@ export class ScreenCaptureDevice {
4688
return _pluginDiv;
4789
}
4890

91+
92+
4993
/**
5094
* Collects all of the possible screen and window sources into an array for later use.
5195
*

0 commit comments

Comments
 (0)