Skip to content

Scene

Defined in: core/scene.ts:33

new Scene(sceneId, name?, uid?): Scene

Defined in: core/scene.ts:43

string | number

string

string

Scene

addAsSource(value?): Promise<any>

Defined in: core/scene.ts:1277

param: (value?: number | Scene)

return: Promise<any>

Adds this scene as a source to the current scene by default. Accepts an optional parameter value, which, when supplied, points to the scene where item will be added instead. If ready config {listenToItemAdd: true} it returns item id, else returns boolean.

Note: There is yet no way to detect error responses for this action.

number | Scene

Promise<any>


addPreset(): Promise<string>

Defined in: core/scene.ts:2093

return: Promise

Add a new preset to the scene, returns the UID of the new preset Does not work on source plugins.

myScene.addPreset().then(function(preset) {
console.log('New preset UID is ' + preset);
});

Promise<string>


getActivePreset(): Promise<string>

Defined in: core/scene.ts:2025

return: Promise

Get the UID of the active preset. Does not work on source plugins.

myScene.getActivePreset().then(function(preset) {
console.log('Active preset UID is ' + preset);
});

Promise<string>


getItems(): Promise<Item[]>

Defined in: core/scene.ts:1778

return: Promise<Item[]>

Gets all the items in a specific scene. See also: #core/Item Core/Item

myScene.getItems().then(function(items) {
// do something to each item in items array
});

Promise<Item[]>


getName(): Promise<string>

Defined in: core/scene.ts:1477

return: Promise

Get the name of this scene object.

myScene.getName().then(function(name) {
console.log('My scene is named ' + name);
});

Promise<string>


getPresets(): Promise<string[]>

Defined in: core/scene.ts:1993

return: Promise<string[]>

Get all presets for the scene, returns an array of preset UIDs Does not work on source plugins.

myScene.getPresets().then(function(presets) {
// do something to each preset UID in UIDs array
});

Promise<string[]>


getPresetTransitionEasing(): Promise<string>

Defined in: core/scene.ts:2159

return: Promise

Get the preset transition easing function for the scene. Does not work on source plugins.

myScene.getPresetTransition().then(function(presetTransition) {
console.log('Preset transition is ' + presetTransition);
});

Promise<string>


getPresetTransitionTime(): Promise<number>

Defined in: core/scene.ts:2223

return: Promise

Get the preset transition time for the scene, in ms Does not work on source plugins.

myScene.getPresetTransitionTime().then(function(presetTransitionTime) {
console.log('Preset transition time is ' + presetTransitionTime);
});

Promise<number>


getSceneIndex(): Promise<number>

Defined in: core/scene.ts:1418

return: Promise

Get the 0-indexed scene number of this scene object.

myScene.getSceneIndex().then(function(num) {
console.log('Scene index is ' + num);
});

Promise<number>


getSceneNumber(): Promise<number>

Defined in: core/scene.ts:1383

return: Promise

Get the 1-indexed scene number of this scene object.

myScene.getSceneNumber().then(function(num) {
console.log('My scene is scene number ' + num);
});

** For deprecation, please use getSceneIndex instead.

Promise<number>


getSceneUid(): Promise<string>

Defined in: core/scene.ts:1453

return: Promise

Get the unique id of this scene object. Scenes unique id is only available for XBC v.3.0.1704.2101 or higher.

myScene.getSceneUid().then(function(res) {
console.log('Scene unique id is ' + res);
});

Promise<string>


getSources(): Promise<Source[]>

Defined in: core/scene.ts:1322

return: Promise<Source[]>

Get all unique Sources from the current scene. Total number of Sources returned may be less that total number of Items on the scenes due to Linked items only having a single Source. See also: #core/Source Core/Source

scene.getSources().then(function(sources) {
for(var i = 0 ; i < sources.length ; i++) {
if(sources[i] instanceof xjs.HtmlSource) {
// Manipulate HTML Source here
}
}
})

Promise<Source[]>


getTopLevelItems(): Promise<Item[]>

Defined in: core/scene.ts:1824

return: Promise<Item[]>

Gets all non-child Items (not belonging to a group) in a specific scene See also: #core/Item Core/Item

myScene.getTopLevelItems().then(function(items) {
// do something to each item in items array
});

Promise<Item[]>


getTransitionList(): Promise<string>

Defined in: core/scene.ts:1520

return: Promise

Get the transition list Result comma separated list of source scene ids with specific transitions

myScene.getTransitionList().then(function(sourceScene) {
// do something here
});

Promise<string>


getTransitionOverride(sourceScene?): Promise<Transition>

Defined in: core/scene.ts:1572

return: Promise

param: (sourceScene: any)

Get the transition override of this scene object. Transition overrides take priority over the more generic one from App.GetTransition See also: #core/Transition Core/Transition and #core/App#getTransition getTransition

myScene.getTransitionOverride().then(function(transition) {
// do something here
});

any = ''

Promise<Transition>


getTransitionTime(sourceScene?): Promise<number>

Defined in: core/scene.ts:1666

return: Promise

param: (sourceScene: any)

Get the transition time override of this scene object. The scene transition time override will only take effect if the scene transition override itself is not equal to ‘’(Transition.NONE)

myScene.getTransitionTime().then(function(time) {
// do something here
});

any = ''

Promise<number>


getTransitionVolume(sourceScene?): Promise<number>

Defined in: core/scene.ts:1724

return: Promise

param: (sourceScene: any)

Get the transition volume override of this scene object. The scene transition volume override will only take effect if the scene transition override itself is not equal to ‘’(Transition.NONE)

myScene.getTransitionVolume().then(function(time) {
// do something here
});

any = ''

Promise<number>


isEmpty(): Promise<boolean>

Defined in: core/scene.ts:1871

return: Promise

Checks if a scene is empty.

myScene.isEmpty().then(function(empty) {
if (empty === true) {
console.log('My scene is empty.');
}
});

Promise<boolean>


removePreset(preset): Promise<boolean>

Defined in: core/scene.ts:2125

param: (preset: string)

return: Promise<boolean>

Remove the specified preset for the scene. Does not work on source plugins.

myScene.removePreset(lastPreset)
.then(isRemoved => {
console.log('preset is removed : ' + isRemoved)
});

string

Promise<boolean>


setItemOrder(items): Promise<Scene>

Defined in: core/scene.ts:1888

param: Array | Array (item IDs)

return: Promise<Scene>

Sets the item order of the current scene. The first item in the array will be on top (will cover items below it).

any[]

Promise<Scene>


setName(name): Promise<boolean>

Defined in: core/scene.ts:1495

param: (value: string) Set the name of this scene object. Cannot be set by source plugins.

myScene.setName('Gameplay');

string

Promise<boolean>


setPresetTransitionEasing(presetTransitionEasing): Promise<boolean>

Defined in: core/scene.ts:2192

param: (presetTransitionEasing: string)

return: Promise<boolean>

Switch to the specified preset transition easing function for the scene Possible values (‘’ or ‘none’, ‘easeInCubic’, ‘easeOutCubic’, ‘easeInOutCubic’) Does not work on source plugins.

myScene.setPresetTransitionEasing('easeInCubic');

string

Promise<boolean>


setPresetTransitionTime(presetTransitionTime): Promise<boolean>

Defined in: core/scene.ts:2252

param: (presetTransitionTime: number)

return: Promise<boolean>

Set the preset transition time for the scene, in ms Does not work on source plugins.

myScene.setPresetTransitionTime(500);

number

Promise<boolean>


setTransitionList(list): Promise<boolean>

Defined in: core/scene.ts:1537

param: (list: string) Set the transition source scene list.

myScene.setTransitionList('TODO');

any

Promise<boolean>


setTransitionOverride(value, sourceScene?): Promise<boolean>

Defined in: core/scene.ts:1626

param: (value: string, sourceScene; string) Set the transition override of this scene object. Transition overrides take priority over the more generic one from App.GetTransition See also: #core/Transition Core/Transition and #core/App#setTransition setTransition

myScene.setTransitionOverride('xjs.Transition.CLOCK');

any

any = ''

Promise<boolean>


setTransitionTime(time, sourceScene?): Promise<boolean>

Defined in: core/scene.ts:1689

param: (value: string, sourceScene: string)

Set the transition time override of this scene object. The scene transition time override will only take effect if the scene transition override itself is not equal to ‘’(Transition.NONE)

myScene.setTransitionTime(1000);

number

any = ''

Promise<boolean>


setTransitionVolume(volume, sourceScene?): Promise<boolean>

Defined in: core/scene.ts:1747

param: (value: string, sourceScene: string)

Set the transition volume override of this scene object. The scene transition volume override will only take effect if the scene transition override itself is not equal to ‘’(Transition.NONE)

myScene.setTransitionVolume(1000);

number

any = ''

Promise<boolean>


switchToPreset(preset): Promise<boolean>

Defined in: core/scene.ts:2061

param: (preset: string)

return: Promise<boolean>

Switch to the specified preset for the scene. Does not work on source plugins.

myScene.getPresets()
.then(presets => {
const lastPreset = presets.pop()
return myScene.switchToPreset(lastPreset);
})
.then(isSwitched => {
console.log('switched to preset : ' + isSwitched)
});

string

Promise<boolean>


static filterItems(func): Promise<Item[]>

Defined in: core/scene.ts:513

param: (func: function)

return: Promise<Item[]>

Searches all scenes for items that satisfies the provided testing function.

Scene.filterItems(function(item, resolve) {
// We'll only fetch Flash Items by resolving 'true' if the item is an
// instance of FlashItem
resolve((item instanceof FlashItem));
}).then(function(items) {
// items would either be an empty array if no Flash items was found,
// or an array of FlashItem objects
});

any

Promise<Item[]>


static filterScenesByItems(func): Promise<Scene[]>

Defined in: core/scene.ts:580

param: (func: function)

return: Promise<Scene[]>

Searches all scenes for items that satisfies the provided testing function, and then return the scene that contains the item.

Scene.filterScenesByItems(function(item, resolve) {
// We'll only fetch the scenes with flash items by resolving 'true' if
// the item is an instance of FlashItem
resolve((item instanceof FlashItem));
}).then(function(scenes) {
// scenes would be an array of all scenes with FlashItem
});

any

Promise<Scene[]>


static filterScenesBySources(func): Promise<Scene[]>

Defined in: core/scene.ts:905

param: (func: function)

return: Promise<Scene[]>

Searches all scenes for sources that satisfies the provided testing function, and then return the scene that contains the source.

Scene.filterScenesBySources(function(source, resolve) {
// We'll only fetch the scenes with flash sources by resolving 'true'
// if the source is an instance of FlashSource
resolve((source instanceof FlashSource));
}).then(function(scenes) {
// scenes would be an array of all scenes with FlashSources
});

any

Promise<Scene[]>


static filterSources(func): Promise<Source[]>

Defined in: core/scene.ts:838

param: (func: function)

return: Promise<Source[]>

Searches all scenes for sources that satisfies the provided testing function.

Scene.filterSources(function(source, resolve) {
// We'll only fetch Flash Sources by resolving 'true' if the source is
// an instance of FlashSource
resolve((source instanceof FlashSource));
}).then(function(sources) {
// sources would either be an empty array if no Flash sources was
// found, or an array of FlashSource objects
});

any

Promise<Source[]>


static getActiveScene(): Promise<Scene>

Defined in: core/scene.ts:266

return: Promise

Get the currently active scene. Does not work on source plugins.

var myScene;
Scene.getActiveScene().then(function(scene) {
myScene = scene;
});

Promise<Scene>


static getById(sceneNum): Promise<Scene>

Defined in: core/scene.ts:117

return: Promise

Get a specific scene object given the scene number.

var scene1;
Scene.getById(1).then(function(scene) {
scene1 = scene;
});

** For deprecation, please use getBySceneIndex instead.

any

Promise<Scene>


static getByName(sceneName): Promise<Scene[]>

Defined in: core/scene.ts:234

return: Promise<Scene[]>

Asynchronous function to get a list of scene objects with a specific name.

Scene.getByName('Game').then(function(scenes) {
// manipulate scenes
});

string

Promise<Scene[]>


static getBySceneIndex(sceneIndex): Promise<Scene>

Defined in: core/scene.ts:159

return: Promise

Get a specific scene object given the scene index.

var scene1;
Scene.getBySceneIndex(0).then(function(scene) {
scene1 = scene;
});

any

Promise<Scene>


static getBySceneUid(sceneUid): Promise<Scene>

Defined in: core/scene.ts:198

return: Promise

Get a specific scene object given the scene unique Id.

var scene1;
Scene.getBySceneUid('{056936DD-DFAA-4148-9D08-21C8E83CE37C}')
.then(function(scene) {
scene1 = scene;
});

string

Promise<Scene>


static getSceneCount(): Promise<number>

Defined in: core/scene.ts:94

return: Promise

Get the specific number of scenes loaded.

var sceneCount;
Scene.getSceneCount().then(function(count) {
sceneCount = count;
});

Promise<number>


static initializeScenes(): Promise<boolean>

Defined in: core/scene.ts:965

return: Promise

Load scenes that are not yet initialized in XSplit Broadcaster.

Note: This is only necessary for XSplit version 2.7 and below. Also, for memory saving purposes, this is not called automatically. If your extension wants to manipulate multiple scenes, it is imperative that you call this function. This function is only available to extensions.

Scene.initializeScenes().then(function(val) {
if (val === true) {
// Now you know that all scenes are loaded :)
}
})

Promise<boolean>


static liveScene(): Scene

Defined in: core/scene.ts:1005

return: Scene

Returns a special liveScene object that may be added as a source to the stage. The Scene.liveScene object whenever called upon, gives access to the current active scene. This is made possible because the liveScene object does not pertain to a real scene in the context of XBC, but the actual view, or at least the scene which is currently loaded in that view.

var xjs = require('xjs');
xjs.Scene.liveScene().addAsSource();

Scene


static searchItemsById(id): Promise<Item>

Defined in: core/scene.ts:338

return: Promise

Searches all scenes for an item by ID. ID search will return exactly 1 result (IDs are unique) or null.

See also: #core/Item Core/Item

Scene.searchItemsById('{10F04AE-6215-3A88-7899-950B12186359}')
.then(function(item) {
// result is either an Item or null
});

string

Promise<Item>


static searchItemsByName(param): Promise<Item[]>

Defined in: core/scene.ts:474

return: Promise<Items[]>

Searches all items for an item by name substring. This function compares against custom name first (recommended) before falling back to the name property of the item.

Scene.searchItemsByName('camera')
.then(function(items) {
// do something to each item in items array
});

Note: With the XBC 2.9 change, linked items would have the same Name and Custom Name. Changes made on an item would reflect on all linked items.

string

Promise<Item[]>


static searchScenesByItemId(id): Promise<Scene>

Defined in: core/scene.ts:403

return: Promise

Searches all scenes for one that contains the given item ID.

Scene.searchScenesByItemId('{10F04AE-6215-3A88-7899-950B12186359}')
.then(function(scene) {
// scene contains the item
});

string

Promise<Scene>


static searchScenesBySourceId(srcId): Promise<Scene[]>

Defined in: core/scene.ts:710

return: Promise

Searches all scenes for one that contains the given source ID.

Scene.searchScenesBySourceId('{10F04AE-6215-3A88-7899-950B12186359}')
.then(function(scenes) {
// scenes that contains the source with matching source id
});

string

Promise<Scene[]>


static searchSourcesById(srcId): Promise<Source[]>

Defined in: core/scene.ts:641

return: Promise

Searches all scenes for a source by ID. ID search will return exactly 1 result (IDs are unique) or null.

See also: #core/Source Core/Source

Scene.searchSourcesById('{10F04AE-6215-3A88-7899-950B12186359}')
.then(function(sources) {
// result would return one instance of the source per scene
});

string

Promise<Source[]>


static searchSourcesByName(param): Promise<Source[]>

Defined in: core/scene.ts:781

return: Promise<Source[]>

Searches all scenes for a source by name substring. This function compares against custom name first (recommended) before falling back to the name property of the source.

Scene.searchSourcesByName('camera').then(function(sources) {
// do something to each source in sources array
});

string

Promise<Source[]>


static setActiveScene(scene): Promise<boolean>

Defined in: core/scene.ts:294

param: scene<number|Scene>

return: Promise<boolean>

Change active scene. Does not work on source plugins.

any

Promise<boolean>