Skip to content

AudioItem

Defined in: core/items/audio.ts:39

The AudioItem class represents an audio device that has been added to the stage.

Inherits from: #core/Item Core/Item

Implements: #core/IAudio Core/IAudio

var XJS = require('xjs');
XJS.Scene.getActiveScene().then(function(scene) {
scene.getItems().then(function(items) {
for (var i in items) {
if (items[i] instanceof XJS.AudioItem) {
// Manipulate your audio device item here
items[i].setSilenceDetectionEnabled(true);
}
}
});
});

All methods marked as Chainable resolve with the original AudioItem instance.

new AudioItem(props?): AudioItem

Defined in: core/items/item.ts:88

AudioItem

Item.constructor

bringForward: () => Promise<Item>

Defined in: core/items/item.ts:617

See: #core/IItemLayout#bringForward bringForward

Promise<Item>

Item.bringForward


bringToFront: () => Promise<Item>

Defined in: core/items/item.ts:622

See: #core/IItemLayout#bringToFront bringToFront

Promise<Item>

Item.bringToFront


getAudioOffset: () => Promise<number>

Defined in: core/items/audio.ts:61

See: #core/AudioSource#getAudioOffset getAudioOffset

Promise<number>

ISourceAudio.getAudioOffset


getCanvasRotate: () => Promise<number>

Defined in: core/items/item.ts:642

See: #core/IItemLayout#getCanvasRotate getCanvasRotate

Promise<number>

Item.getCanvasRotate


getCropping: () => Promise<Object>

Defined in: core/items/item.ts:647

See: #core/IItemLayout#getCropping getCropping

Promise<Object>

Item.getCropping


getCustomName: () => Promise<string>

Defined in: core/items/item.ts:758

See: #core/Source#getCustomName getCustomName

Promise<string>

Item.getCustomName


getEnhancedRotate: () => Promise<number>

Defined in: core/items/item.ts:652

See: #core/IItemLayout#getEnhancedRotate getEnhancedRotate

Promise<number>

Item.getEnhancedRotate


getId: () => Promise<string>

Defined in: core/items/item.ts:267

return: Promise

Get the ID of the Item

item.getId().then(function(id) {
// The rest of your code here
});

Promise<string>

Item.getId


getItemList: () => Promise<Item[]>

Defined in: core/items/item.ts:513

See: #core/Source#getItemList getItemList

Promise<Item[]>

Item.getItemList


getKeepLoaded: () => Promise<boolean>

Defined in: core/items/item.ts:773

See: #core/Source#getKeepLoaded getKeepLoaded

Promise<boolean>

Item.getKeepLoaded


getName: () => Promise<string>

Defined in: core/items/item.ts:748

See: #core/Source#getName getName

Promise<string>

Item.getName


getPosition: () => Promise<Rectangle>

Defined in: core/items/item.ts:657

See: #core/IItemLayout#getPosition getPosition

Promise<Rectangle>

Item.getPosition


getRotateX: () => Promise<number>

Defined in: core/items/item.ts:667

See: #core/IItemLayout#getRotateX getRotateX

Promise<number>

Item.getRotateX


getRotateY: () => Promise<number>

Defined in: core/items/item.ts:662

See: #core/IItemLayout#getRotateY getRotateY

Promise<number>

Item.getRotateY


getRotateZ: () => Promise<number>

Defined in: core/items/item.ts:672

See: #core/IItemLayout#getRotateZ getRotateZ

Promise<number>

Item.getRotateZ


getSilencePeriod: () => Promise<number>

Defined in: core/items/audio.ts:55

See: #core/AudioSource#getSilencePeriod getSilencePeriod

Promise<number>

ISourceAudio.getSilencePeriod


getSilenceThreshold: () => Promise<number>

Defined in: core/items/audio.ts:49

See: #core/AudioSource#getSilenceThreshold getSilenceThreshold

Promise<number>

ISourceAudio.getSilenceThreshold


getType: () => Promise<ItemTypes>

Defined in: core/items/item.ts:786

See: #core/Source#getType getType

Promise<ItemTypes>

Item.getType


getValue: () => Promise<string | XML>

Defined in: core/items/item.ts:763

See: #core/Source#getValue getValue

Promise<string | XML>

ISourceAudio.getValue

Item.getValue


getVolume: () => Promise<number>

Defined in: core/items/audio.ts:69

See: #core/IAudio#getVolume getVolume

Promise<number>

IAudio.getVolume


isAudioAvailable: () => Promise<boolean>

Defined in: core/items/audio.ts:93

See: #core/IAudio#isAudioAvailable isAudioAvailable

Promise<boolean>

IAudio.isAudioAvailable


isAutoMute: () => Promise<boolean>

Defined in: core/items/audio.ts:75

See: #core/IAudio#isAutoMute isAutoMute

Promise<boolean>

IAudio.isAutoMute


isEnhancedResizeEnabled: () => Promise<boolean>

Defined in: core/items/item.ts:637

See: #core/IItemLayout#isEnhancedResizeEnabled isEnhancedResizeEnabled

Promise<boolean>

Item.isEnhancedResizeEnabled


isKeepAspectRatio: () => Promise<boolean>

Defined in: core/items/item.ts:627

See: #core/IItemLayout#isKeepAspectRatio isKeepAspectRatio

Promise<boolean>

Item.isKeepAspectRatio


isMute: () => Promise<boolean>

Defined in: core/items/audio.ts:72

See: #core/IAudio#isMute isMute

Promise<boolean>

IAudio.isMute


isPositionLocked: () => Promise<boolean>

Defined in: core/items/item.ts:632

See: #core/IItemLayout#isPositionLocked isPositionLocked

Promise<boolean>

Item.isPositionLocked


isSilenceDetectionEnabled: () => Promise<boolean>

Defined in: core/items/audio.ts:43

See: #core/AudioSource#isSilenceDetectionEnabled isSilenceDetectionEnabled

Promise<boolean>

ISourceAudio.isSilenceDetectionEnabled


isStreamOnlyAudio: () => Promise<boolean>

Defined in: core/items/audio.ts:87

See: #core/IAudio#isStreamOnlyAudio isStreamOnlyAudio

Promise<boolean>

IAudio.isStreamOnlyAudio


refresh: () => Promise<Source>

Defined in: core/items/item.ts:783

See: #core/Source#refresh refresh

Promise<Source>

Item.refresh


sendBackward: () => Promise<Item>

Defined in: core/items/item.ts:677

See: #core/IItemLayout#sendBackward sendBackward

Promise<Item>

Item.sendBackward


sendToBack: () => Promise<Item>

Defined in: core/items/item.ts:682

See: #core/IItemLayout#sendToBack sendToBack

Promise<Item>

Item.sendToBack


setAudioOffset: (value) => Promise<SourceAudio>

Defined in: core/items/audio.ts:64

See: #core/AudioSource#setAudioOffset setAudioOffset

number

Promise<SourceAudio>

ISourceAudio.setAudioOffset


setAutoMute: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:84

See: #core/IAudio#setAutoMute setAutoMute

boolean

Promise<AudioItem>

IAudio.setAutoMute


setCanvasRotate: (value) => Promise<Item>

Defined in: core/items/item.ts:687

See: #core/IItemLayout#setCanvasRotate setCanvasRotate

number

Promise<Item>

Item.setCanvasRotate


setCropping: (value) => Promise<Item>

Defined in: core/items/item.ts:692

See: #core/IItemLayout#setCropping setCropping

Object

Promise<Item>

Item.setCropping


setCroppingEnhanced: (value) => Promise<Item>

Defined in: core/items/item.ts:697

See: #core/IItemLayout#setCroppingEnhanced setCroppingEnhanced

Object

Promise<Item>

Item.setCroppingEnhanced


setCustomName: () => Promise<Item>

Defined in: core/items/item.ts:753

See: #core/Source#setCustomName setCustomName

Promise<Item>

Item.setCustomName


setEnhancedResizeEnabled: (value) => Promise<Item>

Defined in: core/items/item.ts:717

See: #core/IItemLayout#setEnhancedResizeEnabled setEnhancedResizeEnabled

boolean

Promise<Item>

Item.setEnhancedResizeEnabled


setEnhancedRotate: (value) => Promise<Item>

Defined in: core/items/item.ts:702

See: #core/IItemLayout#setEnhancedRotate setEnhancedRotate

number

Promise<Item>

Item.setEnhancedRotate


setKeepAspectRatio: (value) => Promise<Item>

Defined in: core/items/item.ts:707

See: #core/IItemLayout#setKeepAspectRatio setKeepAspectRatio

boolean

Promise<Item>

Item.setKeepAspectRatio


setKeepLoaded: (value) => Promise<Item>

Defined in: core/items/item.ts:778

See: #core/Source#setKeepLoaded setKeepLoaded

boolean

Promise<Item>

Item.setKeepLoaded


setMute: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:81

See: #core/IAudio#setMute setMute

boolean

Promise<AudioItem>

IAudio.setMute


setName: (value) => Promise<Item>

Defined in: core/items/item.ts:743

See: #core/Source#setName setName

string

Promise<Item>

Item.setName


setPosition: (value) => Promise<Item>

Defined in: core/items/item.ts:722

See: #core/IItemLayout#setPosition setPosition

Rectangle

Promise<Item>

Item.setPosition


setPositionLocked: (value) => Promise<Item>

Defined in: core/items/item.ts:712

See: #core/IItemLayout#setPositionLocked setPositionLocked

boolean

Promise<Item>

Item.setPositionLocked


setRotateX: (value) => Promise<Item>

Defined in: core/items/item.ts:732

See: #core/IItemLayout#setRotateX setRotateX

number

Promise<Item>

Item.setRotateX


setRotateY: (value) => Promise<Item>

Defined in: core/items/item.ts:727

See: #core/IItemLayout#setRotateY setRotateY

number

Promise<Item>

Item.setRotateY


setRotateZ: (value) => Promise<Item>

Defined in: core/items/item.ts:737

See: #core/IItemLayout#setRotateZ setRotateZ

number

Promise<Item>

Item.setRotateZ


setSilenceDetectionEnabled: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:46

See: #core/AudioSource#setSilenceDetectionEnabled setSilenceDetectionEnabled

boolean

Promise<AudioItem>

ISourceAudio.setSilenceDetectionEnabled


setSilencePeriod: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:58

See: #core/AudioSource#setSilencePeriod setSilencePeriod

number

Promise<AudioItem>

ISourceAudio.setSilencePeriod


setSilenceThreshold: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:52

See: #core/AudioSource#setSilenceThreshold setSilenceThreshold

number

Promise<AudioItem>

ISourceAudio.setSilenceThreshold


setStreamOnlyAudio: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:90

See: #core/IAudio#setStreamOnlyAudio setStreamOnlyAudio

boolean

Promise<AudioItem>

IAudio.setStreamOnlyAudio


setValue: (value) => Promise<Item>

Defined in: core/items/item.ts:768

See: #core/Source#setValue setValue

string | XML

Promise<Item>

ISourceAudio.setValue

Item.setValue


setVolume: (value) => Promise<AudioItem>

Defined in: core/items/audio.ts:78

See: #core/IAudio#setVolume setVolume

number

Promise<AudioItem>

IAudio.setVolume


static _emitter: EventEmitter

Defined in: core/items/item.ts:85

Item._emitter


static _subscriptions: any[] = []

Defined in: core/items/item.ts:86

Item._subscriptions

duplicate(options?): Promise<Item>

Defined in: core/items/item.ts:416

param: (options: {linked?:, scene?: })

return: Promise<Item>

Duplicate an item into the current scene or to a specified scene as Linked or Unlinked.

Linked items would generally have a single source, and any changes in the property of an item would be applied to all linked items.

Chainable

// item pertains to an actual Item instance
// Sample 1
item.duplicate() // duplicate selected item to the current scene as unlinked

Duplicate the selected item to a specific scene and set it to be linked to a single source with the original item.

// Sample 2
var toScene = xjs.Scene.getById(2)
item.duplicate({linked:true, scene:toScene})

boolean

number | Scene

Promise<Item>

Item.duplicate


getFPS(): Promise<number>

Defined in: core/items/item.ts:282

return: Promise

Get the frames rendered per second of an item

item.getFPS().then(function(fps) {
// The rest of your code here
});

Promise<number>

Item.getFPS


getParentItem(): Promise<Item>

Defined in: core/items/item.ts:587

return: Promise

Get the GroupItem that contains this item. This rejects if item is not a child item or non-existent

item.getParentItem()
.then(function(parentItem) {
console.log(parentItem);
});

Promise<Item>

Item.getParentItem


getSceneId(): Promise<string | number>

Defined in: core/items/item.ts:351

return: Promise<number|string>

Get (1-indexed) Scene ID where the source is loaded

source.getSceneId().then(function(id) {
// The rest of your code here
});

Promise<string | number>

Item.getSceneId


getSource(): Promise<Source>

Defined in: core/items/item.ts:530

return: Promise

Gets the Source of an item, linked items would only have 1 source.

Chainable

item.getSource().then(function(source) {
//Manipulate source here
source.setName('New Name')
})

Promise<Source>

Item.getSource


getView(): Promise<ViewTypes>

Defined in: core/items/item.ts:320

return: Promise

Get the view type of the item

item.getView().then(function(view) {
// view values:
// 0 = main view
// 1 = preview editor
// 2 = thumbnail preview
})

Promise<ViewTypes>

Item.getView


isChildItem(): Promise<boolean>

Defined in: core/items/item.ts:558

return: Promise

Checks if item is part of a group

item.isChildItem()
.then(function(isChild) {
console.log(isChild);
});

Promise<boolean>

Item.isChildItem


off(event, handler): void

Defined in: core/items/item.ts:224

param: (event: string, handler: Function)

Removes specificied event handler bound by on. Note that this can only be done for named function handlers.

let itemChange = function(...args) {
console.log('Item has changed');
}
let current;
let items;
xjs.Scene.getActiveScene()
.then( scene => {
current = scene;
return current.getItems();
}).then( list => {
items = list;
items[0].on('item-changed', itemChange);
setTimeout( ()=> {
items[0].off('item-changed', itemChange);
}, 10000);
});

string

Function

void

Item.off


on(event, handler): void

Defined in: core/items/item.ts:126

param: (event: string, handler: Function)

Allows listening to events per instance. Currently there are only two: item-changed and item-destroyed.

Item change is triggered thru any property change:

  • via js(source plugin/extension),
  • via visibility-toggling through the sources list,
  • or via the source properties dialog
let itemChange = function(...args) {
console.log('Item has changed');
}
let current;
let items;
xjs.Scene.getActiveScene()
.then( scene => {
current = scene;
return current.getItems();
}).then( list => {
items = list;
items[0].on('item-changed', itemChange);
});

Duplicate handlers are allowed.

string

Function

void

Item.on


remove(): Promise<boolean>

Defined in: core/items/item.ts:504

return: Promise

Removes selected item

item.remove()

Promise<boolean>

Item.remove


toXML(): XML

Defined in: core/items/item.ts:373

return: XML

Convert the Item object to an XML object. Use toString() to get the string version of the returned object.

var xml = item.toXML();

XML

Item.toXML


unlink(): Promise<Item>

Defined in: core/items/item.ts:486

return: Promise

Unlinks selected item.

Unlinks an item to the source of other linked items and renders its own source.

item.unlink()

Note: Once you unlink an Item, there’s still no method to reverse the process.

Promise<Item>

Item.unlink


static getAllSources(): Promise<Source[]>

Defined in: core/source/source.ts:220

return: Promise<Source[]>

Get all unique Source from every scene. Total number of Sources returned may be less than total number of items on all the scenes due to Linked items only having a single Source.

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

Promise<Source[]>

Item.getAllSources


static getCurrentSource(): Promise<Source>

Defined in: core/source/source.ts:108

return: Promise

Get the current source (when function is called by sources), or the source that was right-clicked to open the source properties window (when function is called from the source properties window)

xjs.Source.getCurrentSource().then(function(source) {
// This will fetch the current source (the plugin)
}).catch(function(err) {
// Handle the error here. Errors would only occur
// if we try to execute this method on Extension plugins
});

Promise<Source>

Item.getCurrentSource


static getItemList(): Promise<Item[]>

Defined in: core/items/item.ts:248

return: Promise<Item[]>

Gets the list of linked items of the current Item. Linked items are items linked to a single source.

xjs.Item.getItemList().then(function(items) {
for (var i = 0 ; i < items.length ; i++) {
// Manipulate each item here
items[i].setKeepAspectRatio(true);
}
})

This is simply a shortcut to: xjs.Item.getCurrentSource() -> source.getItemList()

Promise<Item[]>

Item.getItemList