Skip to content

System

Defined in: system/system.ts:68

The System class provides you methods to fetch audio devices to manipulate the application’s audio settings. It also allows you to fetch games, microphone devices and camera devices to add to scenes. Finally, some system-level functionality such as cursor position is exposed.

var XJS = require('xjs');
var System = XJS.System;
System.getCameraDevices().then(function(cameras) {
window.cameras = cameras;
});

new System(): System

System

static getAudioDevices(dataflow?, state?): Promise<AudioDevice[]>

Defined in: system/system.ts:87

return: Promise<AudioDevice[]>

Gets audio devices, both input and output See also: #system/AudioDevice System/AudioDevice

System.getAudioDevices(
XML.AudioDeviceDataflow.ALL,
XML.AudioDeviceState.ACTIVE
).then(function(devices) {
// devices is an array of AudioDevice object
window.audios = devices;
});

AudioDeviceDataflow = AudioDeviceDataflow.ALL

AudioDeviceState = AudioDeviceState.ACTIVE

Promise<AudioDevice[]>


static getAvailableScreens(): Promise<any>

Defined in: system/system.ts:239

return: Promise<Screen[]>

Gets all available screen/windows that may be added to the stage See also: #system/Screen System/Screen

System.getAvailableScreens().then(function(screens) {
screens[0].addToScene(); // add first screen to stage
});

Promise<any>


static getCameraDevices(): Promise<CameraDevice[]>

Defined in: system/system.ts:133

return: Promise<CameraDevice[]>

Gets all camera devices See also: #system/CameraDevice System/CameraDevice

System.getCameraDevices().then(function(devices) {
// devices is an array of CameraDevice object
window.cameras = devices;
});

Promise<CameraDevice[]>


static getCursorPosition(): Promise<any>

Defined in: system/system.ts:340

return: Promise

Gets the position of the cursor. Does not work on Source Plugins.

System.getCursorPosition().then(function(pos) {
var x = pos.x; // X Axis
var y = pos.y; // Y Axis
});

Promise<any>


static getFonts(): Promise<string[]>

Defined in: system/system.ts:309

return: Promise<string[]>

Gets array of system-installed fonts

var mySelect = document.getElementById("mySelect");
System.getSystemFonts().then(function(fontsArray) {
var fontsArrayLength = fontsArray.length;
for (var i = 0; i < fontsArrayLength; ++i) {
var option = document.createElement('option');
option.text = fontsArray[i];
mySelect.add(option);
}
});

Promise<string[]>


static getGames(): Promise<Game[]>

Defined in: system/system.ts:179

return: Promise<Game[]>

Gets all currently running games See also: #system/Game System/Game

System.getGames().then(function(games) {
// games is an array of Game object
window.games = games;
});

Promise<Game[]>


static getMicrophones(): Promise<MicrophoneDevice[]>

Defined in: system/system.ts:208

return: Promise<MicrophoneDevice[]>

Gets all audio capture devices that may be added to the stage See also: #system/MicrophoneDevice System/MicrophoneDevice

System.getMicrophones().then(function(microphones) {
microphones[0].addToScene(); // add first microphone to stage
});

Promise<MicrophoneDevice[]>


static setCursorPosition(pos): Promise<unknown>

Defined in: system/system.ts:373

param: JSON: {x: number, y: number}

Sets the position of the cursor. Does not work on Source Plugins.

System.setCursorPosition({x:0, y:0});

number

number

Promise<unknown>