Scene
Defined in: core/scene.ts:33
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Scene(
sceneId,name?,uid?):Scene
Defined in: core/scene.ts:43
Parameters
Section titled “Parameters”sceneId
Section titled “sceneId”string | number
string
string
Returns
Section titled “Returns”Scene
Methods
Section titled “Methods”addAsSource()
Section titled “addAsSource()”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.
Parameters
Section titled “Parameters”value?
Section titled “value?”number | Scene
Returns
Section titled “Returns”Promise<any>
addPreset()
Section titled “addPreset()”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);});Returns
Section titled “Returns”Promise<string>
getActivePreset()
Section titled “getActivePreset()”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);});Returns
Section titled “Returns”Promise<string>
getItems()
Section titled “getItems()”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});Returns
Section titled “Returns”Promise<Item[]>
getName()
Section titled “getName()”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);});Returns
Section titled “Returns”Promise<string>
getPresets()
Section titled “getPresets()”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});Returns
Section titled “Returns”Promise<string[]>
getPresetTransitionEasing()
Section titled “getPresetTransitionEasing()”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);});Returns
Section titled “Returns”Promise<string>
getPresetTransitionTime()
Section titled “getPresetTransitionTime()”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);});Returns
Section titled “Returns”Promise<number>
getSceneIndex()
Section titled “getSceneIndex()”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);});Returns
Section titled “Returns”Promise<number>
getSceneNumber()
Section titled “getSceneNumber()”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.
Returns
Section titled “Returns”Promise<number>
getSceneUid()
Section titled “getSceneUid()”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);});Returns
Section titled “Returns”Promise<string>
getSources()
Section titled “getSources()”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 } }})Returns
Section titled “Returns”Promise<Source[]>
getTopLevelItems()
Section titled “getTopLevelItems()”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});Returns
Section titled “Returns”Promise<Item[]>
getTransitionList()
Section titled “getTransitionList()”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});Returns
Section titled “Returns”Promise<string>
getTransitionOverride()
Section titled “getTransitionOverride()”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});Parameters
Section titled “Parameters”sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<Transition>
getTransitionTime()
Section titled “getTransitionTime()”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});Parameters
Section titled “Parameters”sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<number>
getTransitionVolume()
Section titled “getTransitionVolume()”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});Parameters
Section titled “Parameters”sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<number>
isEmpty()
Section titled “isEmpty()”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.'); }});Returns
Section titled “Returns”Promise<boolean>
removePreset()
Section titled “removePreset()”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)});Parameters
Section titled “Parameters”preset
Section titled “preset”string
Returns
Section titled “Returns”Promise<boolean>
setItemOrder()
Section titled “setItemOrder()”setItemOrder(
items):Promise<Scene>
Defined in: core/scene.ts:1888
param: Array
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).
Parameters
Section titled “Parameters”any[]
Returns
Section titled “Returns”Promise<Scene>
setName()
Section titled “setName()”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');Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<boolean>
setPresetTransitionEasing()
Section titled “setPresetTransitionEasing()”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');Parameters
Section titled “Parameters”presetTransitionEasing
Section titled “presetTransitionEasing”string
Returns
Section titled “Returns”Promise<boolean>
setPresetTransitionTime()
Section titled “setPresetTransitionTime()”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);Parameters
Section titled “Parameters”presetTransitionTime
Section titled “presetTransitionTime”number
Returns
Section titled “Returns”Promise<boolean>
setTransitionList()
Section titled “setTransitionList()”setTransitionList(
list):Promise<boolean>
Defined in: core/scene.ts:1537
param: (list: string) Set the transition source scene list.
myScene.setTransitionList('TODO');Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<boolean>
setTransitionOverride()
Section titled “setTransitionOverride()”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');Parameters
Section titled “Parameters”any
sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<boolean>
setTransitionTime()
Section titled “setTransitionTime()”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);Parameters
Section titled “Parameters”number
sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<boolean>
setTransitionVolume()
Section titled “setTransitionVolume()”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);Parameters
Section titled “Parameters”volume
Section titled “volume”number
sourceScene?
Section titled “sourceScene?”any = ''
Returns
Section titled “Returns”Promise<boolean>
switchToPreset()
Section titled “switchToPreset()”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)});Parameters
Section titled “Parameters”preset
Section titled “preset”string
Returns
Section titled “Returns”Promise<boolean>
filterItems()
Section titled “filterItems()”
staticfilterItems(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});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<Item[]>
filterScenesByItems()
Section titled “filterScenesByItems()”
staticfilterScenesByItems(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});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<Scene[]>
filterScenesBySources()
Section titled “filterScenesBySources()”
staticfilterScenesBySources(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});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<Scene[]>
filterSources()
Section titled “filterSources()”
staticfilterSources(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});Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<Source[]>
getActiveScene()
Section titled “getActiveScene()”
staticgetActiveScene():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;});Returns
Section titled “Returns”Promise<Scene>
getById()
Section titled “getById()”
staticgetById(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.
Parameters
Section titled “Parameters”sceneNum
Section titled “sceneNum”any
Returns
Section titled “Returns”Promise<Scene>
getByName()
Section titled “getByName()”
staticgetByName(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});Parameters
Section titled “Parameters”sceneName
Section titled “sceneName”string
Returns
Section titled “Returns”Promise<Scene[]>
getBySceneIndex()
Section titled “getBySceneIndex()”
staticgetBySceneIndex(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;});Parameters
Section titled “Parameters”sceneIndex
Section titled “sceneIndex”any
Returns
Section titled “Returns”Promise<Scene>
getBySceneUid()
Section titled “getBySceneUid()”
staticgetBySceneUid(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;});Parameters
Section titled “Parameters”sceneUid
Section titled “sceneUid”string
Returns
Section titled “Returns”Promise<Scene>
getSceneCount()
Section titled “getSceneCount()”
staticgetSceneCount():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;});Returns
Section titled “Returns”Promise<number>
initializeScenes()
Section titled “initializeScenes()”
staticinitializeScenes():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 :) }})Returns
Section titled “Returns”Promise<boolean>
liveScene()
Section titled “liveScene()”
staticliveScene():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();Returns
Section titled “Returns”Scene
searchItemsById()
Section titled “searchItemsById()”
staticsearchItemsById(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});Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Item>
searchItemsByName()
Section titled “searchItemsByName()”
staticsearchItemsByName(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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Item[]>
searchScenesByItemId()
Section titled “searchScenesByItemId()”
staticsearchScenesByItemId(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});Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Scene>
searchScenesBySourceId()
Section titled “searchScenesBySourceId()”
staticsearchScenesBySourceId(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});Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Scene[]>
searchSourcesById()
Section titled “searchSourcesById()”
staticsearchSourcesById(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});Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Source[]>
searchSourcesByName()
Section titled “searchSourcesByName()”
staticsearchSourcesByName(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});Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Source[]>
setActiveScene()
Section titled “setActiveScene()”
staticsetActiveScene(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.
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”Promise<boolean>