ManagerMedia

Table of Contents

Tutorials:

Methods

requestPlaylistsUpdate(callbackopt)

Requests Homey to update all playlists

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:

Promise

requestPlaylistUpdate(playlistId, callbackopt)

Requests Homey to update a playlist

Parameters:
Name Type Attributes Description
playlistId string

The id of the playlist to request an update for

callback genericCallbackFunction <optional>
Returns:

Promise

Type Definitions

Artist

Properties:
Name Type Description
name string

The name of the artist

type string

The type of artist e.g. 'artist', 'composer' or 'producer'

Type:
  • Object

Artwork

Properties:
Name Type Description
artwork.small string

Url of a small image of the artwork, should be around 64px by 64px

artwork.medium string

Url of a medium image of the artwork, should be around 300px by 300px

artwork.large string

Url of a large image of the artwork, should be around 640px by 640px

Type:
  • Object

Codec

A codec is a unique string that defines what data type a track is or a player can play e.g. 'homey:codec:mp3' or 'homey:codec:wav'

Type:
  • string

onGetPlaylistCallback(erropt, playlist)

Parameters:
Name Type Attributes Description
err Error <optional>

Notify Homey of an error that occured. leave 'null' when no error occurred

playlist ManagerMedia#Playlist

The playlist that was requested

onGetPlaylistsCallback(erropt, playlists)

Parameters:
Name Type Attributes Description
err Error <optional>

Notify Homey of an error that occured. leave 'null' when no error occurred

playlists Array.<ManagerMedia#Playlist>

An array of playlists

onPlayCallback(erropt, track)

Parameters:
Name Type Attributes Description
err Error <optional>

Notify Homey of an error that occured. leave 'null' when no error occurred

track Object
Name Type Attributes Description
stream_url string

The stream url for the requested track and codec

* * <optional>

Other ManagerMedia#Track properties can be given to update them realtime before the track is showed to the user.

onSearchCallback(erropt, result)

Parameters:
Name Type Attributes Description
err Error <optional>

Notify Homey of an error that occured while searching. leave 'null' when no error occurred

result Array.<ManagerMedia#Track>

An array of tracks matching the search query

Playlist

A playlist object contains metadata of the playlist and an array of tracks

Properties:
Name Type Description
id string

A unique id for the playlist

title string

The title of the playlist

tracks Array.<ManagerMedia#Track>

The tracks in the playlist

Type:
  • Object

Track

A track object contains all data of a track and is used by the speaker and Homey to show information about the track to the user

Properties:
Name Type Attributes Description
id string

An unique id of the track

title string

The title of the track

duration number

The duration of the track in ms

codecs Array.<ManagerMedia#Codec>

The available Media-Codecs codecs this app can supply of the track

artist Array.<ManagerMedia#Artist> <optional>

An array of artists that made the track

album string <optional>

The album the track is on

artwork ManagerMedia#Artwork <optional>

The artwork of the track or album

genre string <optional>

The genre of the track

release_date string <optional>

The release date of the track as string, format must be 'YYYY-MM-DD'

bitrate number <optional>

The bitrate of the track

bpm number <optional>

The bpm of the track

confidence number <optional>

The confidence value (between 0 and 1) which estimates if this is the track the user is looking for, only required for ManagerMedia#onSearchCallback

options Object <optional>

A JSON serializable options object that can be used to add relevant app-specific metadata to the track object

Type:
  • Object

Events

getPlaylist

Event is fired when Homey needs the data of a specific playlist to update the playlist data to show to the user

Parameters:
Name Type Description
request Object

The playlist request object

Name Type Description
playlist_id string

The id of the playlist that is requested

callback ManagerMedia#onGetPlaylistCallback

The callback that needs to be called with all playlists

getPlaylists

Event is fired when Homey needs the data of all playlists this app has so it can show them to the user

Parameters:
Name Type Description
callback ManagerMedia#onGetPlaylistsCallback

The callback that needs to be called with all playlists

play

Event that is fired when the user requests to play a track from this app. The app should return a stream_url with the correct codec which can be played

Parameters:
Name Type Description
trackData Object
Name Type Description
trackId string

The id of the track as supplied by ManagerMedia#search or ManagerMedia#getPlaylists

codec string

The Media-Codecs codec that is requested for this track

callback ManagerMedia#onPlayCallback

The callback that needs to be called with the track url

search

Event that is fired when a user wants to search for track from this app

Parameters:
Name Type Description
query Object
Name Type Description
searchQuery

The search query string to search tracks for

callback ManagerMedia#onSearchCallback

The callback that needs to be called with the search result