Skip to main content

Media Data Provider

Media player data transfer between iCUE and HTML widgets: currently playing track information and playback controls.

Overview​

  • Module name: widgetbuilder.mediadataprovider
  • Plugin name: Media
  • Version: 1.0

Manifest entry:

"required_plugins": [
  "widgetbuilder.mediadataprovider:Media:1.0"
]

Properties​

PropertyTypeDescription
songNamestringCurrent song name
artiststringCurrent artist name

Methods​

getSongName(requestId)​

Gets the current song name asynchronously.

ParameterTypeDescription
requestIdintRequest ID for correlation

Response: string

getArtist(requestId)​

Gets the current artist name asynchronously.

ParameterTypeDescription
requestIdintRequest ID for correlation

Response: string

triggerPlayPause()​

Toggles play/pause state.

triggerNextTrack()​

Skips to the next track.

triggerPreviousTrack()​

Returns to the previous track.

Signals​

asyncResponse(requestId, value)​

Emitted when an async method completes.

ParameterTypeDescription
requestIdintOriginal request ID
valuevarResponse value

SimpleMediaApiWrapper​

Promise-based wrapper for the Media plugin. Converts the callback-based Qt async API into Promises.

Important: Use Local Wrapper Files​

Copy common/plugins/ from the documentation bundle into your widget folder and include wrappers via local <script src> paths.

Do not reference iCUE installation paths (for example ../common/plugins/...) in third-party widgets.

Initialization​

const api = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider);
ParameterTypeDefaultDescription
pluginobject-Plugin instance (window.plugins.Mediadataprovider)
timeoutMsnumber5000Request timeout (ms)

Methods​

getSongName()​

Returns Promise<string> with the current song name.

getArtist()​

Returns Promise<string> with the current artist name.

Required local files​

<script src="common/plugins/IcueWidgetApiWrapper.js"></script>
<script src="common/plugins/SimpleMediaApiWrapper.js"></script>

Example​

manifest.json

"required_plugins": [
  "widgetbuilder.mediadataprovider:Media:1.0"
]

index.html

// After including IcueWidgetApiWrapper and SimpleMediaApiWrapper in <head>:
const mediaApi = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider);

async function displayCurrentTrack() {
    const [songName, artist] = await Promise.all([
        mediaApi.getSongName(),
        mediaApi.getArtist(),
    ]);
    console.log(`Now playing: ${songName} by ${artist}`);
}

// Playback controls (synchronous — call directly on the plugin)
window.plugins.Mediadataprovider.triggerPlayPause();
window.plugins.Mediadataprovider.triggerNextTrack();
window.plugins.Mediadataprovider.triggerPreviousTrack();