import QtQuick Item { property bool empty: false property bool playing: true property bool restricted: false property int actionCount: 0 property int seekCount: 0 property int selectCount: 0 property string lastAction: "" function playerRow() { return { "id": "media-fixture", "identity": "fixture player", "title": "fixture track", "artist": "fixture artist", "album": "fixture album", "playbackState": playing ? "playing" : "paused", "position": 30, "length": 120, "progress": 0.25, "shuffle": false, "repeat": "none", "canSeek": !restricted, "canShuffle": !restricted, "canRepeat": !restricted, "cover": "", "artAvailable": false }; } function stateJson() { const player = playerRow(); return JSON.stringify({ "players": empty ? [] : [player], "activePlayer": empty ? null : player, "mediaPanelContract": {} }); } function nativePlayerById(id) { return { "canControl": true, "canGoPrevious": false, "canGoNext": !restricted, "canTogglePlaying": !restricted }; } function action(kind) { actionCount++; lastAction = String(kind); if (lastAction === "playPause") playing = !playing; return stateJson(); } function seek(position) { seekCount++; return stateJson(); } function select(id) { selectCount++; return stateJson(); } function restrictCapabilities() { restricted = true; } }