Link Search Menu Expand Document

Core Classes

Classes

GorillaEngine

Gorilla Engine top level API object providing common functions for your plugin's application layer. This object is instantiated automatically on plugin instantiation and is accessible through global.GorillaEngine.

Blob

The blob class handles access to the instruments contained in the loaded blob file.

Instrument

Class representing an Instrument.

Parameter
UI
PreviewPlayer

A class that is used to play audio files of different formats without the need to map them in the engine and the capability to stream files from URLs.

Interfaces

FileChooserOptions

Options to configure appearance and behaviour of the file chooser dialog.

BuildInformation

An object containing various information compiled into the plugin binary.

FileChooserOptions

Options to configure appearance and behaviour of the file chooser dialog.

Kind: global interface
Properties

Name Type Default Description
[allowMultiple] boolean false Enable or disable selection of multiple files.
[browseDirectory] boolean false Defines whether the user is to select files or folders.
[saveDialog] boolean false Defines whether it is a dialog for saving or loading files.
[warnOnOverwrite] boolean true If enabled, a warning is displayed whe a user attempts to overwrite an existing file.
hint string   Can only be changed on macOS only when saveDialog is set to true. Text displayed in the title bar.
[allowedExtensions] string "*.*" Restricts which file extensions can be used.
[defaultLocation] TYPE user home directory The file system location that is selected when opening the dialog.

BuildInformation

An object containing various information compiled into the plugin binary.

Kind: global interface
Properties

Name Description
branch -
commitHash -
buildNumber -
pluginName -
pluginDescription -
pluginManufacturer -
manufacturerWebsite -
manufacturerEmail -
manufacturerCode -
pluginCode -
JucePlugin_IsSynth -
JucePlugin_WantsMidiInput -
JucePlugin_ProducesMidiOutput -
JucePlugin_IsMidiEffect -
JucePlugin_EditorRequiresKeyboardFocus -
version -
versionCode -
versionString -
JucePlugin_VSTUniqueID -
JucePlugin_VSTCategory -
JucePlugin_AUMainType -
JucePlugin_AUSubType -
JucePlugin_AUExportPrefix -
JucePlugin_AUExportPrefixQuoted -
JucePlugin_AUManufacturerCode -
JucePlugin_CFBundleIdentifier -
JucePlugin_RTASCategory -
JucePlugin_RTASManufacturerCode -
JucePlugin_RTASProductId -
JucePlugin_RTASDisableBypass -
JucePlugin_RTASDisableMultiMono -
JucePlugin_AAXIdentifier -
JucePlugin_AAXManufacturerCode -
JucePlugin_AAXProductId -
JucePlugin_AAXCategory -
JucePlugin_AAXDisableBypass -
JucePlugin_AAXDisableMultiMono -
JucePlugin_IAAType -
JucePlugin_IAASubType -
JucePlugin_IAAName -

GorillaEngine

Gorilla Engine top level API object providing common functions for your plugin’s application layer. This object is instantiated automatically on plugin instantiation and is accessible through global.GorillaEngine.

Kind: global class
Properties

Name Type Description
UI UI Object providing functions relevant to creating user interfaces and containing all types of available controls.

gorillaEngine.loadBlob(path) ⇒ Blob

Load an instrument blob file from the filesystem. Note: A blob file exported in two parts (“Separate Headers in Gorilla Editor”) is required.

Kind: instance method of GorillaEngine
Returns: Blob - An instance of the blob class.

Param Type Description
path string The absolute path to part 1 of the instrument blob file to load.

gorillaEngine.setActiveInstrument(instrument)

It is possible to load multiple instruments, however only one can be active for audio rendering and general interaction at any time. This function allows to specify which of the loaded instruments is the active one.

Kind: instance method of GorillaEngine

Param Type Description
instrument Instrument The instrument object returned from loadInstrument.

gorillaEngine.setSessionSaveCallback(callback, callbackScope) ⇒ boolean

This function can be used to register a callback that is called every time the DAW session is saved.

Kind: instance method of GorillaEngine
Returns: boolean - True if setting the callback succeded.

Param Type Description
callback undefined The callback function to set.
callbackScope object The scope object that can be accessed in the callback function via this.

gorillaEngine.setSessionLoadCallback(callback, callbackScope) ⇒ boolean

This function can be used to register a callback that is called every time a DAW session is loaded.

Kind: instance method of GorillaEngine
Returns: boolean - True if setting the callback succeded.

Param Type Description
callback undefined The callback function to set.
callbackScope object The scope object that can be accessed in the callback function via this.

gorillaEngine.openFileChooser(options) ⇒ Promise.<Array.<string>>

Opens a native system dialog for selecting files or folders.

Kind: instance method of GorillaEngine
Returns: Promise.<Array.<string>> - A promise that resolves to an array of pathes that the user selected in the file chooser dialog.

Param Type Description
options FileChooserOptions Options to configure appearance and behaviour of the file chooser dialog.

gorillaEngine.openFileChooserSync(options) ⇒ Array.<string>

Synchronous version of openFileChooser

Kind: instance method of GorillaEngine
Returns: Array.<string> - An array of pathes that the user selected in the file chooser dialog.

Param Type Description
options FileChooserOptions Options to configure appearance and behaviour of the file chooser dialog.

gorillaEngine.getPreviewPlayer() ⇒ PreviewPlayer

Returns the singleton instance of the PreviewPlayer class used for playing audio files of different formats.

Kind: instance method of GorillaEngine
Returns: PreviewPlayer - The instance.

gorillaEngine.registerEditorCallbacks(openingCallback, closingCallback) ⇒ boolean

When a plugin window is closed in the DAW, it gets completely destroyed and then again completely constructed when shown again. This function can be used to register two callbacks that are called when a plugin window gets constructed respectively deconstructed.

Kind: instance method of GorillaEngine
Returns: boolean - True if setting the callbacks succeeded.

Param Type Description
openingCallback undefined The callback function to set.
closingCallback undefined The callback function to set.

gorillaEngine.registerUncaughtUIExceptionCallback(closingCallback) ⇒ boolean

This function can be used to register a callback that gets called whenever an exception occurs in JavaScript.

Kind: instance method of GorillaEngine
Returns: boolean - True if registering the callback succeeded.

Param Type Description
closingCallback undefined The callback function to set.

gorillaEngine.getResourcePath() ⇒ string

This function returns the installation path of your plugin. Note: this is not the path to the VST/AU/AAX binary but to the folder holding the blob file, JavaScript files, graphical assets etc. Typically this resolves to /Library/Application Support/ManufacturerName/PluginName resp. C:\Program Data\ManufacturerName\PluginName

Kind: instance method of GorillaEngine
Returns: string - The absolute path to the ressource directory.

gorillaEngine.getPluginType() ⇒ string

Returns a textual description of the Plugin Format.

Kind: instance method of GorillaEngine
Returns: string - A textual description of the Plugin Format. Possible values: Undefined, VST, VST3, AU, AUv3, RTAS, AAX, Standalone, Unity.

gorillaEngine.getPluginName() ⇒ string

Returns the name of the plugin as defined in Gorilla Compiler.

Kind: instance method of GorillaEngine
Returns: string - The name of the plugin as defined in Gorilla Compiler.

gorillaEngine.getManufacturerName() ⇒ string

Returns the name of the plugin manufacturer as defined in Gorilla Compiler.

Kind: instance method of GorillaEngine
Returns: string - The name of the plugin manufacturer as defined in Gorilla Compiler.

gorillaEngine.getBuildInformation() ⇒ BuildInformation

Returns an object of various information compiled into the plugin binary. These options are configured in Gorilla Compiler.

Kind: instance method of GorillaEngine
Returns: BuildInformation - The build information compiled into the plugin binary.

gorillaEngine.openURLinBrowser(param1) ⇒ TYPE

Kind: instance method of GorillaEngine

Param Type Description
param1 TYPE -

gorillaEngine.updateHostDisplay() ⇒

Can be used to indicate to the DAW that something about the plugin has changed. Note: Does not do the same thing (if anything) in each and every DAW.

Kind: instance method of GorillaEngine

gorillaEngine.getHostDescription() ⇒ string

This function can be used to determine the DAW your plugin is running in.

Kind: instance method of GorillaEngine
Returns: string - The name of the DAW or “unknown”

gorillaEngine.showNativeMessageBoxSync(Title, Message, IconType) ⇒

Displays a message in an OS style message box.

Kind: instance method of GorillaEngine

Param Type Description
Title string The caption displayed in the header.
Message string The message to display.
IconType string Defines which item to display. Possible values: info, warning, error.

gorillaEngine.checkLicense(param1) ⇒ TYPE

Kind: instance method of GorillaEngine

Param Type Description
param1 TYPE -

gorillaEngine.isTrial(param1) ⇒ TYPE

Kind: instance method of GorillaEngine

Param Type Description
param1 TYPE -

gorillaEngine.trialExpirationTimestamp(param1) ⇒ TYPE

Kind: instance method of GorillaEngine

Param Type Description
param1 TYPE -

gorillaEngine.disposeInstrument(instrument) ⇒ boolean

Releases the given instrument and all the resources that it allocated. You MUST not access the given instrument anymore after disposing it.

Kind: instance method of GorillaEngine
Returns: boolean - true if the instrument was disposed or false otherwise.

Param Type Description
instrument Instrument The instrument to dispose.

gorillaEngine.setParametersDirty(dirty) ⇒

Set the dirty flag for all parameters. If it is set to false, changing any of the parameters, be it via UI, JS or automation will set the flag to true.

Kind: instance method of GorillaEngine

Param Type Description
dirty boolean Wether the parameters should be flagged as dirty.

gorillaEngine.areParametersDirty() ⇒ boolean

Get the current status of the parameters dirty flag.

Kind: instance method of GorillaEngine
Returns: boolean - true if the parameters have not changed since the last setParametersDirty(false) call. false otherwise

gorillaEngine.setParametersDirtyCallback(parametersDirtyCallback) ⇒ boolean

Register a function that will be called each time the parameters dirty flag changes. This can be used to implement a preset changed indicator for example

Kind: instance method of GorillaEngine
Returns: boolean - True if setting the callback succeeded.

Param Type Description
parametersDirtyCallback undefined undefined

Blob

The blob class handles access to the instruments contained in the loaded blob file.

Kind: global class
Properties

Name Type Description
uuid string The uuid of the blob.

blob.setInstrumentLocatorCallback(callback, context) ⇒ boolean

Registers a callback that allows to return an instrument state for a given instrument name when an instrument is loaded. This callback can be used to override the instrument state contained in a blob file.

Kind: instance method of Blob
Returns: boolean - If setting the callback succeded.

Param Type Description
callback function The callback function to set.
context object An optional context parameter that will be accessible as this in the callback.

blob.setInstrumentEnumeratorCallback(callback, context) ⇒ boolean

Registers a callback that allows to augment the result of Blob~getInstrumentNames().

Kind: instance method of Blob
Returns: boolean - If setting the callback succeded.

Param Type Description
callback function The callback function to set.
context object An optional context parameter that will be accessible as this in the callback.

blob.loadInstrument(instrumentName) ⇒ Instrument

Load an instrument with the given name from either the blob file or the state that was returned from the instrumentLocatorCallback if any.

Kind: instance method of Blob
Returns: Instrument - The loaded instrument object.

Param Type Description
instrumentName string The name of the instrument to load.

blob.getInstrumentNames() ⇒ Array.<string>

Returns a list of the names of the instruments contained in the blob file combined with instrument names returned from the `instrumentEnumeratorCallback if any.

Kind: instance method of Blob
Returns: Array.<string> - The instrument names of the blob.

blob.setContentPackMapping(contentPackMappings)

Creates a list of mappings from identifiers to paths that can be used to dynamically locate samples when they’re mapped in Gorilla Engine.

Kind: instance method of Blob

Param Type Description
contentPackMappings Array.<Object> The content mappings to set.

blob.setResolveContentPackPathCallback(callback, object) ⇒ boolean

Registers a callback that allows to locate a directory identified by the given identifier. This callback is called from Gorilla Engine when it encounters a sample path containing the content pack indicator ‘>’

Kind: instance method of Blob
Returns: boolean - If setting the callback succeded.

Param Type Description
callback function The callback function to set.
object object -

Instrument

Class representing an Instrument.

Kind: global class

instrument.getValueAtPath(path) ⇒ string | Object | Number | Int32Array | Float64Array | boolean

Method used to retrieve a value from the Gorilla Engine.

Kind: instance method of Instrument
Returns: string | Object | Number | Int32Array | Float64Array | boolean - The value found at the given path or false if nothing was found.

Param Type Description
path string The path to the value that should be retrieved.

instrument.isModuleAtPath(path) ⇒ boolean

Test if the value at the given path is a module.

Kind: instance method of Instrument
Returns: boolean - true if the value found at the given path is module or false otherwise.

Param Type Description
path string The path that should be tested.

instrument.valueToStringAtPath(path, value) ⇒ string | boolean

Tries to use the parameter at the given path to convert the given value to a text. I.e. used to denormalise a normalised value for the given parameter.

Kind: instance method of Instrument
Returns: string | boolean - The denormalised value with it’s unit as a text or false if the value could not be denormalised.

Param Type Description
path string The path to the instrument parameter that should be used to denormalise the value.
value double The value that should be denormalised.

instrument.getModuleAtPath(path) ⇒ string | boolean

Retrives the JSON representation of the module at the given path.

Kind: instance method of Instrument
Returns: string | boolean - The JSON representation of the module found at the given path or false if there is no module at the given path.

Param Type Description
path string The path to the module that should be retrieved.

instrument.setStringAtPath(path, value) ⇒ boolean

Sets a string at the given path. I.e. the path of sample in a Zone module. Hint: Prepend the sample indicator ‘<’ to point to a sample on disk.

Kind: instance method of Instrument
Returns: boolean - true if the string was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value string The value that should be set at the given path.

instrument.getStringAtPath(path) ⇒ string | false

Returns a string from the given path.

Kind: instance method of Instrument
Returns: string | false - The string found at the given path or false if the path didn’t exist or the value wasn’t a string.

Param Type Description
path string The path to the value that should read from.

instrument.getWaveformOverview(width, zoneId, start, end, verticalZoom) ⇒ Uint8Array

Returns a waveform overview of the zone with the given id.

Kind: instance method of Instrument
Returns: Uint8Array - The waveform overview as a squence of Uint8.

Param Type Description
width int The width of the waveform.
zoneId int The id of the zone of which the waveform should be created.
start double The start of the section of which the waveform should be created. Must be in the range of [0 <= n < end].
end double The end of the section of which the waveform should be created. Must be in the range of [start < n <= 1.0].
verticalZoom double The vertical zoom of the waveform. Must be in the range of [0 <= n <= 1] where a value of 0 is auto zoom.

instrument.getSampleMetadata(filePath, overviewSize) ⇒ Object

Returns metadata and waveform overview of an audio file passed in

Kind: instance method of Instrument
Returns: Object - An object containing properties metadata of type string and overview as Uint8Array

Param Type Description
filePath string The path to the audio file to read metadata from.
overviewSize int The size of the overview to be generated

instrument.getIntArrayAtPath(path) ⇒ Int32Array | false

Returns an Int32Array from the given path.

Kind: instance method of Instrument
Returns: Int32Array | false - The Int32Array found at the given path or false if the path didn’t exist or the value wasn’t an Int32Array.

Param Type Description
path string The path to the value that should read from.

instrument.setIntArrayAtPath(path, value) ⇒ boolen

Sets an Int32Array at the given path.

Kind: instance method of Instrument
Returns: boolen - true if the Int32Array was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value Int32Array The value that should be set at the given path.

instrument.getDoubleArrayAtPath(path) ⇒ Float64Array | false

Returns a Float64Array from the given path.

Kind: instance method of Instrument
Returns: Float64Array | false - The Float64Array found at the given path or false if the path didn’t exist or the value wasn’t a Float64Array.

Param Type Description
path string The path to the value that should read from.

instrument.setDoubleArrayAtPath(path, value) ⇒ boolen

Sets a Float64Array at the given path.

Kind: instance method of Instrument
Returns: boolen - true if the Float64Array was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value Float64Array The value that should be set at the given path.

instrument.getDoubleAtPath(path) ⇒ double | false

Returns a double from the given path.

Kind: instance method of Instrument
Returns: double | false - The double found at the given path or false if the path didn’t exist or the value wasn’t a double.

Param Type Description
path string The path to the value that should read from.

instrument.setDoubleAtPath(path, value) ⇒ boolean

Sets a double at the given path.

Kind: instance method of Instrument
Returns: boolean - true if the double was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value double The value that should be set at the given path.

instrument.setIntAtPath(path, value) ⇒ boolean

Sets an int at the given path.

Kind: instance method of Instrument
Returns: boolean - true if the int was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value int The value that should be set at the given path.

instrument.getIntAtPath(path) ⇒ int | false

Returns an int from the given path.

Kind: instance method of Instrument
Returns: int | false - The int found at the given path or false if the path didn’t exist or the value wasn’t an int.

Param Type Description
path string The path to the value that should read from.

instrument.setModuleAtPath(module) ⇒ boolean

Set a module at the given path. I.e. used to create new mappings or to insert new effects into FX Busses.

Kind: instance method of Instrument
Returns: boolean - true if the module was created or false otherwise.

Param Type Description
module string The JSON representation of the module that should be set at the given path.

instrument.removeModuleAtPath(path) ⇒ boolean

Removes a module from the given path. I.e. used to remove mappings or effects from FX Busses.

Kind: instance method of Instrument
Returns: boolean - true if the module was removed or false otherwise.

Param Type Description
path string The path to the module that should be removed.

instrument.setNormalizedDoubleAtPath(path, value) ⇒ boolean

Sets a normalised double at the given path.

Kind: instance method of Instrument
Returns: boolean - true if the normalised double was set or false otherwise.

Param Type Description
path string The path to the value that should be set.
value double The value that should be set at the given path.

instrument.getNormalizedDoubleAtPath(path) ⇒ double | false

Returns a normalised ouble from the given path.

Kind: instance method of Instrument
Returns: double | false - The normalised double found at the given path or false if the path didn’t exist or the value wasn’t a normalised double.

Param Type Description
path string The path to the value that should read from.

instrument.getMidiDragData(param1) ⇒ TYPE

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.renderAudioFile(param1) ⇒ TYPE

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.renderAudioFileFromMidi(param1) ⇒ TYPE

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.on(paramName, handler) ⇒ number

Attach an event listener to an instrument parameter. Whenever the instrument parameter changes the callback will be called with the current normalized value of the parameter. Does not trigger for meter parameters.

Kind: instance method of Instrument
Returns: number - it will always return 1 to indicate success

Param Type Description
paramName string the instrument parameter name
handler function the callback

instrument.off(paramName, handler) ⇒ number

Dettach one or multiple event listeners for an instrument parameter. Pass in a reference to the callback to remove a specific listener. If no callback is passed then all listenersfor that parameter are removed

Kind: instance method of Instrument
Returns: number - the number of removed listeners

Param Type Description
paramName string the instrument parameter name
handler function optionally: the callback

instrument.noteOn(param1) ⇒ TYPE

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.noteOff(param1) ⇒ TYPE

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.getLoadingStatus(param1) ⇒ TYPE

Returns if samples are currently being loaded (at plugin startup or later when purging/activating mappings or loading a different instrument).

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.getLoadingProgressPercent(param1) ⇒ TYPE

Returns a value from 0 to 99 while samples are being loaded (at plugin startup or later when purging/activating mappings or loading a different instrument). When loading has finished the value stays at 100 %.

Kind: instance method of Instrument

Param Type Description
param1 TYPE -

instrument.startRecallingParameterState() ⇒ void

Tells the audio engine that parameters are about to be recalled. This is a hint for gorilla scripts to skip applying parameter inter-dependencies

Kind: instance method of Instrument
Returns: void - This function does not return anything.

instrument.endRecallingParameterState() ⇒ void

Tells the audio engine that parameter recalling has finished and normal operation can resume.

Kind: instance method of Instrument
Returns: void - This function does not return anything.

instrument.getMIDICCstate() ⇒ Array

Get the current MIDI CC assignment state. Example state: [{ cc: 7, path: 'Scripts/0/Volume' }]

Kind: instance method of Instrument
Returns: Array - The MIDI CC state array.

instrument.setMIDICCstate(state) ⇒ void

Sets the MIDI CC assignments. This will replace ALL previous assignments with the state provided.

Kind: instance method of Instrument
Returns: void - This function does not return anything.

Param Type Description
state Array The MIDI CC state array.

instrument.addParameter(persistence_flags) ⇒ Parameter

Creates a dynamic parameter that can be connected to a path in the engine using the Parameter.connect() function.

Kind: instance method of Instrument
Returns: Parameter - The newly created dynamic parameter.

Param Type Description
persistence_flags int The persistence of the parameter. The flags are: Private = 0x000, ShowInHost = 0x001, SaveInSession = 0x002, SaveInPreset = 0x004,

Parameter

Kind: global class
Properties

Name Type Description
normValue TYPE A normalised [0..1] representation of its value.
value TYPE It’s actual value
normValueAsync TYPE set the normalized value from the main thread, so changes will not be instantly observable
valueAsync TYPE set the value from the main thread, so changes will not be instantly observable
defaultValue TYPE -
minValue TYPE -
maxValue TYPE -
resolution TYPE -
numSteps TYPE -
controlType TYPE Returns a string hinting the most suitable UI control for the parameter. Possible values are: default: usually a knob, could also be a slider or drag/spin control volume: audio volume control down to silence, often a vertical slider but could be horizontal or a knob drag: more suited to a drag/spin control because usually only a small part of the range is used keySelect: select a MIDI note outSelect: select an audio output (zero for default, negative values for internal busses) modSource: select from a list of mod sources (where mod source names should be inserted instead of numbers) voiceGroup: select from a list of voice groups (where voice group names should be inserted instead of numbers) (the above types can fall back to e.g. ControlTypeDrag if no special behaviour is implemented for them in the UI) onOffSwitch: toggle between Off/On (could be a power switch or “Bypass” or “Solo” etc. - see parameter name) switch: toggle between two values that are not Off/On, could also be displayed as a menu menu: dropdown menu, could also be a multi-way switch or a stepped knob if there are not many steps levelMeter: audio level meter: display should apply log scaling (may have multiple channels) meter: meter that may be showing something other than audio level (may have multiple channels) display: numeric or text display: value is not user editable text: editable text textBox: multi-line text with at least copy/paste of the whole text, if not full editing array: edit multiple values e.g. as a bargraph waveform: display a waveform overview notVisible: not intended for display to the user
key TYPE -
name TYPE -
category TYPE -
label TYPE -
text TYPE -
unit TYPE -
steps TYPE -
persistence TYPE -

parameter.connect(path, numMeterChannels) ⇒ void

Connect a parameter created by Instrument.addParameter() to a path in the engine. This will throw when called a non dynamic parameter.

Kind: instance method of Parameter
Returns: void - This function does not return anything.

Param Type Description
path string The path to property in the engine.
numMeterChannels int An optional arguments that specifies the number of meter channels.

parameter.disconnect() ⇒ void

Disconnect a parameter created by Instrument.addParameter() to a path in the engine. This will throw when called a non dynamic parameter.

Kind: instance method of Parameter
Returns: void - This function does not return anything.

UI

Kind: global class

UI.createWindow(window) ⇒ Object

This function creates a Window to your plugin given the UI.Window object

Kind: static method of UI
Returns: Object - Handle to the Window object.

Param Type Description
window Object UI.Window object to use to create the window to your plugin

UI.loadUIfromYAML(filepath)

Kind: static method of UI

Param Type Description
filepath string Filepath of the YAML file.

UI.autoGenerate()

Kind: static method of UI

UI.getControlById(id) ⇒ Object

Kind: static method of UI
Returns: Object - Handle to the control object.

Param Type Description
id string ID of the control.

PreviewPlayer

A class that is used to play audio files of different formats without the need to map them in the engine and the capability to stream files from URLs.

Kind: global class

previewPlayer.play(url) ⇒ Promise.<int>

Plays a file from a URL. Supported file formats are mp3, ogg, aif and wav.

Kind: instance method of PreviewPlayer
Returns: Promise.<int> - A promise that resolves to the played file’s length in seconds when the stream starts to play.

Param Type Description
url string The URL of the file to play. To play a file from disk use a file:// URL.

previewPlayer.pause()

Pauses playback.

Kind: instance method of PreviewPlayer

previewPlayer.resume()

Resumes playback.

Kind: instance method of PreviewPlayer

previewPlayer.togglePause()

Toggles between playback and pause.

Kind: instance method of PreviewPlayer

previewPlayer.setVolume(volume)

Set’s the volume of the playing stream.

Kind: instance method of PreviewPlayer

Param Type Description
volume float The volume to be set formatted as a float in the range [0..1].

previewPlayer.setPosition(position)

Seek to a given position in the stream. Will only work if the underlying stream is seekable.

Kind: instance method of PreviewPlayer

Param Type Description
position int The posittion to seek to in seconds.

previewPlayer.on(event, callback)

Register an event listener with the PreviewPlayer instance that fires whenever the stream playback progresses but not more often than every 333ms.

Kind: instance method of PreviewPlayer

Param Type Description
event "playheadProgress" The name of the event.
callback undefined The callback function to execute when playback progresses.