Webportal v2

embedded apps

API Reference - media.mediaInfo

Required Privacy: Data & Location

This API allows to retrieve the current media info.

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
appId

Name of your App.

string

tld.domain.subdomain

com.example.app
trackName

Current track name.

string

n/a

Starman
artistName

Current artist name.

string

n/a

David Bowie
albumName

Current album name.

string

n/a

Ziggy Stardust and the Spiders from Mars
covertArtPicture

Current cover art.

string

n/a

data:image/png;base64,...
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
webportal.get(
    /* api name */
    "media.mediaInfo",
    /* parameters */
     null
  )
  /* callback for `REPLY` messages */
  .then((message) => {
    if (message.status === 200) {
      /* handle `REPLY` success */
    }
    else { /* handle `REPLY` error */ }
  })
1
2
3
4
5
6
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "GET", 
  "api": "media.mediaInfo",
  "params":  null
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// --- format of the `REPLY` message ---

{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "api": "media.mediaInfo",
  "status": 200,
  "statusText": "OK", 
  "data":  { 
    "appId": "com.example.app",
    "trackName": "Starman",
    "artistName": "David Bowie",
    "albumName": "Ziggy Stardust and the Spiders from Mars",
    "covertArtPicture": "data:image/png;base64,..."
  } 
}

false

This API allows to retrieve the current media info.

Input Parameter
Param name Description Type Unit/Values Example Required
appId

Name of your App.

string

tld.domain.subdomain

com.example.app true
trackName

Current track name.

string

n/a

Starman true
artistName

Current artist name.

string

n/a

David Bowie true
albumName

Current album name.

string

n/a

Ziggy Stardust and the Spiders from Mars true
covertArtPicture

Current cover art.

string

n/a

data:image/png;base64,... true
Output Data
No outputted data
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
webportal.set(
    /* api name */
    "media.mediaInfo",
    /* parameters */
     { 
      "appId": "com.example.app",
      "trackName": "Starman",
      "artistName": "David Bowie",
      "albumName": "Ziggy Stardust and the Spiders from Mars",
      "covertArtPicture": "data:image/png;base64,..."
        }
  )
  /* callback for `REPLY` messages */
  .then((message) => {
    if (message.status === 200) {
      /* handle `REPLY` success */
    }
    else { /* handle `REPLY` error */ }
  })
1
2
3
4
5
6
7
8
9
10
11
12
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "SET", 
  "api": "media.mediaInfo",
  "params":  { 
    "appId": "com.example.app",
    "trackName": "Starman",
    "artistName": "David Bowie",
    "albumName": "Ziggy Stardust and the Spiders from Mars",
    "covertArtPicture": "data:image/png;base64,..."
  }
}
1
2
3
4
5
6
7
8
9
// --- format of the `REPLY` message ---

{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "api": "media.mediaInfo",
  "status": 200,
  "statusText": "OK"
}

false

This API allows to retrieve the current media info.

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
appId

Name of your App.

string

tld.domain.subdomain

com.example.app
trackName

Current track name.

string

n/a

Starman
artistName

Current artist name.

string

n/a

David Bowie
albumName

Current album name.

string

n/a

Ziggy Stardust and the Spiders from Mars
covertArtPicture

Current cover art.

string

n/a

data:image/png;base64,...
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
webportal.subscribe(
    /* api name */
    "media.mediaInfo",
    /* parameters */
     null,
    /* callback for `NOTIFY` messages */
    async (notifyMessage) => {
      if (notifyMessage.status === 200) {
        /* handle `NOTIFY` response */
      }
      else { /*  handle `NOTIFY` error  */ }
    }
  )
  /* callback for `REPLY` messages */
  .then((message) => {
    if (message.status === 200) {
      /* handle `REPLY` success */
    }
    else { /* handle `REPLY` error */ }
  })
1
2
3
4
5
6
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "SUBSCRIBE", 
  "api": "media.mediaInfo",
  "params":  null
}
1
2
3
4
5
6
7
8
9
10
11
// --- format of the `REPLY` message ---
// type: acknowledge the status of the subscription
// reception: only once after the subscription request
// contains outputed data: no
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "status": 200,
  "statusText": "OK"
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// --- format of the `NOTIFY` message ---
// type: event message about the subscription
// reception: each time the conditions of the subscription are met
// contains outputed data: yes
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "NOTIFY",
  "api": "media.mediaInfo",
  "status": 200,
  "statusText": "OK", 
  "data":  { 
    "appId": "com.example.app",
    "trackName": "Starman",
    "artistName": "David Bowie",
    "albumName": "Ziggy Stardust and the Spiders from Mars",
    "covertArtPicture": "data:image/png;base64,..."
  } 
}