diff --git a/companion-modules/media-player-classic/README.md b/companion-modules/media-player-classic/README.md index a7680b8..b23127e 100644 --- a/companion-modules/media-player-classic/README.md +++ b/companion-modules/media-player-classic/README.md @@ -46,16 +46,16 @@ their selected version until you explicitly change them. Open **Presets → MPC_DEV → Transport & timing** and drag the buttons onto a spare page. These presets already include their feedback and variable references: -| Preset | Behavior | -| --------------------- | --------------------------------------------------------------- | -| ▶ Play | Thin green outline; thicker while playing, amber while paused | -| ■ Stop | Stop command; thicker red outline while stopped | -| ◀◀ Previous / ▶▶ Next | Previous/next **playlist item**, not chapter or seek | -| Mute | Toggle mute; thicker red outline and **MUTED** while muted | -| Pause | Pause command; thicker amber outline while paused | -| Remaining | Live media countdown and progress bar | -| Elapsed | Live elapsed media time and progress bar | -| Playback state | Playing, paused, stopped, idle, or offline with matching colors | +| Preset | Behavior | +| --------------------- | ------------------------------------------------------------------------- | +| ▶ Play | Subdued green while stopped; full green while playing, amber while paused | +| ■ Stop | Subdued red while playing; full red while stopped | +| ◀◀ Previous / ▶▶ Next | Previous/next **playlist item**, not chapter or seek | +| Mute | Neutral when unmuted; full red **MUTED** while muted | +| Pause | Pause command; amber while paused | +| Remaining | Live media countdown and progress bar | +| Elapsed | Live elapsed media time and progress bar | +| Playback state | Playing, paused, stopped, idle, or offline with matching colors | The Previous/Next transport presets use command IDs verified against this player's `/commands.json`: Previous → `919`, Next → `920`. The old catalog was @@ -64,11 +64,12 @@ Navigation-related labels are corrected; numeric action IDs still send their same numeric commands. Re-add copied presets to existing buttons to apply this correction; linked presets follow the module update. -Transport buttons use white icons/text on dark backgrounds with thin colored -outlines: green Play, red Stop, amber Pause, blue Previous/Next, and purple Mute. -Active controls have thicker outlines; paused Play turns amber and muted audio -turns red with **MUTED** text. Offline outlines turn grey. Timing displays stay -dark with their progress bars. Backup sync retains its dedicated status colors. +Transport buttons use white labels on filled backgrounds. Play is subdued green +until playing, when it becomes full green; Stop is subdued red until stopped, +when it becomes full red. Previous/Next stay subdued blue. Mute is neutral when +unmuted and full red with **MUTED** text when muted. Playback state is full green +while playing, full red while stopped, and amber while paused. Timers stay dark +with progress bars; backup sync keeps its original status colors. Re-add copied presets to apply styling updates; linked presets update automatically. The progress bar fills from left to right. It turns amber with 10 seconds left diff --git a/companion-modules/media-player-classic/companion/HELP.md b/companion-modules/media-player-classic/companion/HELP.md index 28f4743..bacdbca 100644 --- a/companion-modules/media-player-classic/companion/HELP.md +++ b/companion-modules/media-player-classic/companion/HELP.md @@ -8,8 +8,8 @@ in this connection. Allow remote access from the Companion computer if needed. Choose **Transport & timing** in this connection's Presets: -- **Play**: thin green outline while waiting; thicker while playing; amber while paused. Press to play/resume. -- **Stop**: thicker red outline while stopped. +- **Play**: subdued green while stopped; full green while playing; amber while paused. Press to play/resume. +- **Stop**: subdued red while playing; full red while stopped. - **Previous / Next**: navigate playlist items (verified command IDs 919/920). These load and start playback; the web API has no reliable open-next-paused command. A Next-then-Stop sequence can briefly play and is not offered as cueing. @@ -22,12 +22,13 @@ The bar fills left to right, turning amber with 10 media seconds left and red with 5 seconds left. All 138 original command presets remain in **All commands**. Open File opens a dialog on the player computer; it does not upload a file. -Transport buttons use dark backgrounds and white labels with thin colored -outlines: green Play, red Stop, amber Pause, blue Previous/Next, and purple Mute. -Active controls have thicker outlines; mute turns red with **MUTED** text. -Offline outlines turn grey. Timers keep their progress bars on dark backgrounds. -Backup sync keeps its dedicated status colors. Re-add copied presets for the new -style; linked presets update automatically. +Transport buttons use white labels on filled backgrounds. Play is subdued green +until playing, when it becomes full green; Stop is subdued red until stopped, +when it becomes full red. Previous/Next stay subdued blue. Mute is neutral when +unmuted and full red with **MUTED** text when muted. Playback state is full green +while playing, full red while stopped, and amber while paused. Timers stay dark +with progress bars; backup sync keeps its original status colors. +Re-add copied presets to apply styling updates; linked presets update automatically. ## Optional backup diff --git a/companion-modules/media-player-classic/src/definitions.js b/companion-modules/media-player-classic/src/definitions.js index e734b7d..8c00a11 100644 --- a/companion-modules/media-player-classic/src/definitions.js +++ b/companion-modules/media-player-classic/src/definitions.js @@ -46,17 +46,17 @@ export function presets(label = 'MPC_DEV') { options: {}, style: { text: 'OFFLINE', bgcolor: colors.dark, color: 0x889099 }, } - const active = (feedbackId, text) => ({ + const active = (feedbackId, bgcolor, text) => ({ feedbackId, options: {}, - style: { ...(text ? { text } : {}) }, + style: { bgcolor, color: bgcolor === colors.amber ? colors.dark : colors.white, ...(text ? { text } : {}) }, }) - const button = (name, text, id, feedback = [], size = '18', control = null) => ({ + const button = (name, text, id, feedback = [], size = '18', bgcolor = colors.dark) => ({ type: 'simple', name, - style: { text, size, color: colors.white, bgcolor: colors.dark, show_topbar: false }, + style: { text, size, color: colors.white, bgcolor, show_topbar: false }, steps: [{ down: id ? [{ actionId: id, options: { target: 'both' } }] : [], up: [] }], - feedbacks: [...feedback, ...(control ? [{ feedbackId: 'transport_border', options: { control } }] : []), offline], + feedbacks: [...feedback, offline], }) const transport = { transport_redundancy: { @@ -70,16 +70,29 @@ export function presets(label = 'MPC_DEV') { 'Play — green while playing', '▶\nPLAY', '887', - [active('paused', 'Ⅱ\nPAUSED')], + [active('playing', colors.green), active('paused', colors.amber, 'Ⅱ\nPAUSED')], '18', - 'play', + 0x244534, + ), + transport_stop: button( + 'Stop — red while stopped', + '■\nSTOP', + '890', + [active('stopped', colors.red)], + '18', + 0x502d34, ), - transport_stop: button('Stop — red while stopped', '■\nSTOP', '890', [], '18', 'stop'), // Verified against MPC-HC 2.8.5's /commands.json: 918 is an after-playback setting. - transport_previous: button('Previous playlist item', '◀◀\nPREV', '919', [], '18', 'navigation'), - transport_next: button('Next playlist item', '▶▶\nNEXT', '920', [], '18', 'navigation'), - transport_mute: button('Toggle mute — red while muted', 'MUTE', '909', [active('muted', 'MUTED')], '18', 'mute'), - transport_pause: button('Pause — amber while paused', 'Ⅱ\nPAUSE', '888', [], '18', 'pause'), + transport_previous: button('Previous playlist item', '◀◀\nPREV', '919', [], '18', 0x243b50), + transport_next: button('Next playlist item', '▶▶\nNEXT', '920', [], '18', 0x243b50), + transport_mute: button( + 'Toggle mute — red while muted', + 'MUTE', + '909', + [active('muted', colors.red, 'MUTED')], + '18', + ), + transport_pause: button('Pause — amber while paused', 'Ⅱ\nPAUSE', '888', [active('paused', colors.amber)], '18'), transport_remaining: button( 'Remaining time and progress', `LEFT\n$(${label}:remaining)`, @@ -94,7 +107,13 @@ export function presets(label = 'MPC_DEV') { [{ feedbackId: 'progress_bar', options: {} }], '14', ), - transport_state: button('Playback state', `$(${label}:state_label)`, null, [], '14', 'state'), + transport_state: button( + 'Playback state', + `$(${label}:state_label)`, + null, + [active('playing', colors.green), active('paused', colors.amber), active('stopped', colors.red)], + '14', + ), } return { ...transport, ...catalog } } diff --git a/companion-modules/media-player-classic/test/state.test.js b/companion-modules/media-player-classic/test/state.test.js index 6b5aa8f..3551141 100644 --- a/companion-modules/media-player-classic/test/state.test.js +++ b/companion-modules/media-player-classic/test/state.test.js @@ -62,11 +62,8 @@ test('transport presets use playlist commands and state feedback; time displays assert.equal(buttons[`transport_${preset}`].steps[0].down[0].actionId, command) assert.equal(buttons[`transport_${preset}`].feedbacks.at(-1).feedbackId, 'offline') } - assert.equal( - buttons.transport_play.feedbacks.find((f) => f.feedbackId === 'transport_border').options.control, - 'play', - ) - assert.equal(buttons.transport_stop.feedbacks[0].options.control, 'stop') + assert.equal(buttons.transport_play.feedbacks[0].feedbackId, 'playing') + assert.equal(buttons.transport_stop.feedbacks[0].feedbackId, 'stopped') assert.equal(buttons.transport_mute.feedbacks[0].feedbackId, 'muted') assert.equal(buttons.transport_remaining.style.text, 'LEFT\n$(MY_PLAYER:remaining)') assert.deepEqual(buttons.transport_remaining.steps[0].down, [])