overwolf.media.audio

A set of functions for playback of audio files. Currently supports MP3 and WAV files.

Methods

create(url, callback)

Version added: 0.84.0

Creates an audio file from local path, extension local path or a remote Url.

  • Parameter: url <string>

    The path of a local audio file, a url to a remote one or an extension url (overwolf-extension://app-id/file). Notice that if the url doesn’t contain a file extension, mp3 will be assumed as the extension.

  • Parameter: callback <function>

    A callback function which will be called with the ID of the created audio file.
Callback argument:
{
    "status": "success",
    "id": "1086e4469a5fb242e81223ce627e3747"
}

play(id, callback)

Version added: 0.84.0

Plays the audio file matching the supplied ID.

  • Parameter: id <string>

    The ID of the audio file to be played.

  • Parameter: callback <function>

    A callback function which will be called with the status of the play request.
Callback argument:
{
    "status": "success"
}

stop(callback)

Version added: 0.84.0

Stops the playback.

  • Parameter: callback <function>

    A callback function which will be called with the status of the stop request.

Callback argument:
{
    "status": "success"
}

stopById(id, callback)

Version added: 0.86.0

Stops the playback.

  • Parameter: id <string>

    The ID of the audio file.
  • Parameter: callback <function>

    A callback function which will be called with the status of the stop request.

pause(callback)

Version added: 0.84.0

Pauses the playback.

  • Parameter: callback <function>

    A callback function which will be called with the status of the pause request.

pauseById(id, callback)

Version added: 0.86.0

Pauses the playback of a specific sound.

  • Parameter: id

    The ID of the audio file.
  • Parameter: callback <function>

    A callback function which will be called with the status of the pause request.

resume(callback)

Version added: 0.84.0

Resumes the playback.

  • Parameter: callback <function>

    A callback function which will be called with the status of the resume request.

resumeById(id, callback)

Version added: 0.86.0

Resumes the playback of a specific file.

  • Parameter: id <string>

    The ID of the audio file.
  • Parameter: callback <function>

    A callback function which will be called with the status of the resume request.

setVolume(volume, callback)

Version added: 0.84.0

Sets the playback volume.

  • Parameter: volume <int>

    The desired volume. The volume range is 0 – 100 where a volume of 0 means mute.

  • Parameter: callback <function>

    A callback function which will be called with the status of the setVolume request.

setVolumeById(id, volume, callback)

Version added: 0.86.0

Sets the playback volume of a specific file.

  • Parameter: id <string>

    The ID of the audio file.

  • Parameter: volume <int>

    The desired volume. The volume range is 0 – 100 where a volume of 0 means mute.

  • Parameter: callback <function>

    A callback function which will be called with the status of the setVolume request.

Events How to use events

onPlayStateChanged

Version added: 0.84.0

Fired when the state of the playback is changed.

Event value:
{
    "id": "1086e4469a5fb242e81223ce627e3747",
    "playback_state": "paused"
}