You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Homey.ManagerAudio

const { ManagerAudio } = require('homey');

Table of Contents

Methods

playMp3(sampleId, sampleopt, callbackopt)

Play MP3 audio sample

Parameters:
Name Type Attributes 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.

callback genericCallbackFunction <optional>
Returns:

Promise

playWav(sampleId, sampleopt, callbackopt)

Play WAV audio sample

Parameters:
Name Type Attributes 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.

callback genericCallbackFunction <optional>
Returns:

Promise

removeMp3(sampleId, callbackopt)

Remove MP3 sample from cache

Parameters:
Name Type Attributes Description
sampleId string

The id of the MP3 that is cached

callback genericCallbackFunction <optional>

removeWav(sampleId, callbackopt)

Remove WAV sample from cache

Parameters:
Name Type Attributes Description
sampleId string

The id of the WAV that is cached

callback genericCallbackFunction <optional>