Skip to content

Commit

Permalink
fix recordStatus for all device types
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenrick committed Jun 10, 2022
1 parent 64023c0 commit 8e2d43e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 17 deletions.
11 changes: 10 additions & 1 deletion JS_Files/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,19 @@ export class Audio {
*
* @return {string} - Device identifier used to describe device output
*/
getKind() {
getKind() {
return this.#kind;
}

/**
* Getter function to retrieve the device recording status based on video and audio
*
* @return {string} - Device identifier used to describe device recording status
*/
getRecordStatus() {
return (this.#audioCheckbox.checked);
}

monitorAudio(stream) {
let max_level_L = 0;
let old_level_L = 0;
Expand Down
4 changes: 2 additions & 2 deletions JS_Files/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export class Camera {
*
* @return {string} - Device identifier used to describe device recording status
*/
getRecordStatus() {
return (this.#audioCheckbox.checked || this.#videoCheckbox.checked);
getRecordStatus() {
return (this.#audioCheckbox.checked || this.#videoCheckbox.checked);
}


Expand Down
13 changes: 5 additions & 8 deletions JS_Files/chronosense.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,11 @@ async function recordAllSelectedDevices() {
})
selectedDevices.forEach((device) => {
// Checks whether or not Audio or Video is selected if not do not start
if (device.getRecordStatus() == false) {
console.log('Audio and Video are both off')
}
else {
// Start recording
device.setDirName(recordDirectory);
device.startRecording();
numRecording++;
if (device.getRecordStatus()) {
// Start recording
device.setDirName(recordDirectory);
device.startRecording();
numRecording++;
}
});
}
Expand Down
56 changes: 50 additions & 6 deletions JS_Files/screen_capture_device.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const remote = require('@electron/remote');
import { AVRecorder } from './avRecorder.js';

export class ScreenCaptureDevice {

#label = "Screen Capture";
#deviceId = "ScreenCaptureModule";
#deviceId = "ScreenCapture";
#groupId = "ScreenCapture";
#kind = "screencapture";
#label = "ScreenCapture";
#videoElement = null;
#optionContainer = null;
#sources = []
Expand All @@ -27,10 +28,51 @@ export class ScreenCaptureDevice {
/**
* Constructor for a ScreenCaptureDevice object that captures stream of video/audio from user screens & windows.
*
* @param {string} deviceId - Identifier for the device used in input capture.
* @param {string} groupId - Identifier for the device group used in input capture.
* @param {string} kind - Identifier for type of input from device.
* @param {string} label - Name Identifier (Sensical to user for reading).
*/
constructor() {
this.getCaptureSources();
}
constructor(deviceId, groupId, kind, label) {
this.#deviceId = "ScreenCapture";
this.#groupId = "ScreenCapture";
this.#kind = "screencapture";
this.#label = "ScreenCapture";

this.getCaptureSources();
}

getPluginDiv() {
let _pluginDiv = this.#pluginDiv;
return _pluginDiv;
}

/**
* Getter function to retrieve the object's Group ID
*
* @return {string} - Group identifier used to connect it to other similar devices
*/
getGroupId() {
return this.#groupId;
}

/**
* Getter function to retrieve the object's "kind"
*
* @return {string} - Device identifier used to describe device output
*/
getKind() {
return this.#kind;
}

/**
* Getter function to retrieve the device recording status based on video and audio
*
* @return {string} - Device identifier used to describe device recording status
*/
getRecordStatus() {
return (this.#videoCheckbox.checked);
}

fixForMacOS() {
if(process.platform === "darwin") {
Expand All @@ -46,6 +88,8 @@ export class ScreenCaptureDevice {
return _pluginDiv;
}



/**
* Collects all of the possible screen and window sources into an array for later use.
*
Expand Down

0 comments on commit 8e2d43e

Please sign in to comment.