Webportal v2

embedded apps

API Reference - media.availableAudioSource

Required Privacy: Location
Operations:

This API allows to work with infotainment system audio sources.

Info: iap stand for the ipod/iphone communication protocol.

Note: like in the native Media player, changing media source will also automatically play the newly selected source.

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
data[n]
 .id

ID of the source (for object number ‘n’ of the data array).

int

n/a

65
data[n]
 .type

Type of the source (for object number ‘n’ of the data array).

Enum of strings

- bluetooth

- usb

- webportal

- tuner

- ipod

- Tuner-FM

- Tuner-AM

- Tuner-DAB
bluetooth
data[n]
 .name

Name of the source (for object number ‘n’ of the data array).

string

n/a

bluetooth
data[n]
 .contentInfo
  .audio

Information about the number of audio files for bluetooth & ipod (for object number ‘n’ of the data array).

int

n/a

3
data[n]
 .contentInfo
  .video

Information about the video content of this source (for object number ‘n’ of the data array).

int

n/a

5
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
webportal.get(
    /* api name */
    "media.availableAudioSource",
    /* 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.availableAudioSource",
  "params":  null
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// --- format of the `REPLY` message ---

{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "api": "media.availableAudioSource",
  "status": 200,
  "statusText": "OK", 
  "data": {
    [
      {
        "id": 65,
        "type": "bluetooth",
        "name": "Phone of John Doe",
        "contentInfo": {}
      },
      {
        "id": 35,
        "type": "tuner",
        "name": "Radio",
      },
      {
        "id": 55,
        "type": "usb",
        "name": "USB Stick of Kiran",
        "contentInfo": {
            "audio": 52,
            "video": 0
        }
      },
      {
        "id": 56,
        "type": "usb",
        "name": "Natalia",
        "contentInfo": {
            "audio": 13,
            "video": 2
        }
      },
      {
        "id": 135,
        "type": "webportal",
        "name": "Spotify",
        "contentInfo": {}
      },
      {
        "id": -1,
        "type": "Tuner-FM",
        "name": "RADIO"
      },
      {
        "id": -2,
        "type": "Tuner-AM",
        "name": "RADIO"
      },
      {
        "id": -3,
        "type": "Tuner-DAB",
        "name": "RADIO"
      }
    ]
  } 
}

false

This API allows to work with infotainment system audio sources.

Info: iap stand for the ipod/iphone communication protocol.

Note: like in the native Media player, changing media source will also automatically play the newly selected source.

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
data
 .id

ID of the source triggering the notification).

int

n/a

65
data
 .type

Type of the source triggering the notification.

Enum of strings

- bluetooth

- usb

- ipod

- webportal

- Tuner-FM

- Tuner-AM

- Tuner-DAB
bluetooth
data
 .name

Name of the source triggering the notification.

string

n/a

bluetooth
data
 .contentInfo
  .audio

Information about the audio content of this source triggering the notification.

int

n/a

3
data
 .contentInfo
  .video

Information about the video content of this source triggering the notification.

int

n/a

5
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.availableAudioSource",
    /* 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.availableAudioSource",
  "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
19
20
21
// --- 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.availableAudioSource",
  "status": 200,
  "statusText": "OK", 
  "data": {
    "id": 2,
    "type": "webportal",
    "availability": "unavailable",
    "name": "Phone of John Doe ",
    "contentInfo": {
      "audio": 13,
      "video": 2
    }
  } 
}