API: Check Current Audio Output

Allows you to check which audio output is currently in use by the device.

Requirements

Kiosk Pro Enterprise

  • Integration of our JavaScript API into your webpage
    • Sample code to run within the app and download for integration into your own project is available here.
    • Best practices for working with the JavaScript API are available here.
  • App Settings
    • Content > JavaScript API > Access JavaScript API = By Import


Triggers via API Functions

Check Current Audio Output

This function determines which audio output is currently being used.

Format
kp_AudioSessionAPI_getCurrentAudioOutputPortType(callback);
		
Parameters callback - [string] the name of the callback to be triggered after the function has been executed
Callback format
callback(outputPortTypeString);
		
Callback return values

outputPortTypeString - [string] representing the current output type. Possible values are:

  • LineOut - line level output on a dock connector
  • Headphones - headphone or headset output
  • BluetoothA2DPOutput - Bluetooth A2DP device
  • Receiver - speaker you hold to your ear when on a phone call
  • Speaker - built-in speaker of the iOS/iPadOS device
  • HDMIOutput - High-Definition Multimedia Interface device
  • AirPlay - remote Air Play device
  • BluetoothLE - Bluetooth Low Energy device
  • BluetoothHFP - Bluetooth Hands-Free Profile device
  • USBAudio - Universal Serial Bus device
  • CarAudio - car audio


Notifications via API Callbacks

On Audio Output Change

This callback is triggered when the audio output has changed. For example, when headphones are plugged into the device.

Format
kp_AudioSessionAPI_audioOutputPortTypeDidChange(outputPortTypeString);
		
Return values

outputPortTypeString - [string] representing the current output type. Possible values are:

  • LineOut - line level output on a dock connector
  • Headphones - headphone or headset output
  • BluetoothA2DPOutput - Bluetooth A2DP device
  • Receiver - speaker you hold to your ear when on a phone call
  • Speaker - built-in speaker of the iOS/iPadOS device
  • HDMIOutput - High-Definition Multimedia Interface device
  • AirPlay - remote Air Play device
  • BluetoothLE - Bluetooth Low Energy device
  • BluetoothHFP - Bluetooth Hands-Free Profile device
  • USBAudio - Universal Serial Bus device
  • CarAudio - car audio


Sample Code

  • This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
  • To run sample code, set the app's homepage to kioskgroup.com/audio-output-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 9.0.7

Still stuck? How can we help? How can we help?