ManagerAudio

You can access this manager through the Homey instance as this.homey.audio

Methods

playMp3

playMp3(sampleId, sampleopt): Promise.<any>

Play MP3 audio sample

Parameters

Name Type Description
sampleId
string

unique id which can be used to play sounds that have been played before

sample
Buffer | string <optional>

Buffer containing a MP3 audio sample or path to file containing MP3 audio sample data. Sample is cached in Homey and can be played again by calling this function with the same sampleId without the sample argument which will result in the the sample loading faster.

Returns

Promise.<any>

playWav

playWav(sampleId, sampleopt): Promise.<any>

Play WAV audio sample

Parameters

Name Type Description
sampleId
string

unique id which can be used to play sounds that have been played before

sample
Buffer | string <optional>

Buffer containing a WAV audio sample or path to file containing WAV audio sample data. Sample is cached in Homey and can be played again by calling this function with the same sampleId without the sample argument which will result in the the sample loading faster.

Returns

Promise.<any>

removeMp3

removeMp3(sampleId): Promise.<any>

Remove MP3 sample from cache

Parameters

Name Type Description
sampleId
string

The id of the MP3 that is cached

Returns

Promise.<any>

removeWav

removeWav(sampleId): Promise.<any>

Remove WAV sample from cache

Parameters

Name Type Description
sampleId
string

The id of the WAV that is cached

Returns

Promise.<any>