diff --git a/companion-modules/media-player-classic/README.md b/companion-modules/media-player-classic/README.md index d4e3e97..324e391 100644 --- a/companion-modules/media-player-classic/README.md +++ b/companion-modules/media-player-classic/README.md @@ -97,11 +97,44 @@ with the player, follows seeks, and does not predict wall-clock completion at nonstandard playback speeds. Playback state is MPC's reported state, not proof that frames or audio are physically reaching an output device. -## Experimental Load next +## EXPERIMENTAL — Load next: not a guaranteed cue/preload -Drag **Load next (experimental)** from **Transport & timing** onto a spare button. -This is a workaround, not a true open-paused command: MPC-HC may briefly display -moving video before Stop takes effect. Test on non-live output first. +> **EXPERIMENTAL: this button deliberately starts the next video, then tries to +> stop it. It does not load the next item paused, and it cannot guarantee that no +> moving frames reach the output. It is not a proven production cue/preload +> feature. Automated mock tests have passed; the sequence has not yet been +> validated on the user's real MPC-HC player.** + +Find it under **Presets → MPC_DEV → EXPERIMENTAL — test before use**. Its full +preset/action name starts with **EXPERIMENTAL**, and the button displays **EXP** +in every state, including success, failure, and offline. **EXP means experimental, +not expired.** It is deliberately separate from the regular transport presets. +Existing copied buttons need re-adding to receive the label; linked presets update. + +**Do not first test this on a live program output.** Use a spare button and an +output where brief playback is acceptable. Observe the actual video and listen +to the actual audio; a green connection indicator or successful HTTP response +is not proof that the output was silent or that no frames played. + +**What this experiment does and does not guarantee:** + +- It waits for MPC-HC's _reported_ mute state before advancing. This is not a + measurement of physical audio output, and another controller can change mute. +- It intentionally sends the normal autoplaying Next command. Stop can arrive + before loading finishes or take effect late; retries reduce this risk but do + not remove it. Network delays and player behavior affect the result. +- **LOADED NEXT is a status-based confirmation, not a guarantee of seamless + preload.** It means a different reported filename remained stopped for at + least 500 ms and the original mute setting was confirmed. It does not prove + which playlist entry was selected, that no frames played, or where playback + will resume. Check these on your player and media. +- Failure can leave the new file playing but muted if Stop cannot be delivered + or applied. **LOAD FAILED does not mean the player is safely stopped.** Inspect + MPC-HC before manually unmuting, playing, or pressing Load next again. +- A configured backup has its own outcome. Main success does not certify the + backup. A player that was already muted stays muted after success. + +### Experimental sequence 1. Read fresh state and remember the current file and mute setting. 2. Mute if needed and wait for player feedback confirming mute. Never retry a @@ -115,7 +148,7 @@ moving video before Stop takes effect. Test on non-live output first. 5. Only then restore the original mute setting and confirm it. A player that started muted stays muted. -The button shows **LOADING**, **LOADED NEXT**, or **LOAD FAILED**, following the +The button retains **EXP** above **LOADING**, **LOADED NEXT**, or **LOAD FAILED**, following the main player. `load_next_status` and `load_next_detail` expose the result; `backup_load_next_status` and `backup_load_next_detail` expose the backup result. Each targeted player runs independently. The default target is Both; no backup @@ -138,6 +171,16 @@ following the single Next command is the available evidence of advancement; external playlist changes cannot be distinguished. True preload without any playback still requires an MPC-HC open-paused API or a helper on the player PC. +### Before considering this usable for your show + +Test stopped and playing starting states; initially muted and unmuted audio; +slow-loading files; the last playlist entry; repeat/loop behavior; duplicate +filenames; connection loss; repeated presses; and main/backup failures. Confirm +that Play starts the loaded media from the expected position. Keep using the +regular transport controls until this experiment is satisfactory with your +actual player, media, network, and output routing. This label remains experimental +until explicitly reviewed and promoted; success in mocks alone is insufficient. + ## Optional backup player In this connection's configuration, keep your existing **Main player** host/port diff --git a/companion-modules/media-player-classic/companion/HELP.md b/companion-modules/media-player-classic/companion/HELP.md index b4fd4c0..db8806f 100644 --- a/companion-modules/media-player-classic/companion/HELP.md +++ b/companion-modules/media-player-classic/companion/HELP.md @@ -13,13 +13,6 @@ Choose **Transport & timing** in this connection's Presets: - **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. -- **Load next (experimental)**: confirm mute, advance once, stop immediately and - retry Stop as needed. Restore the original mute setting only after a different - filename is confirmed stopped for 500 ms. Video may briefly play. Failed - loading leaves audio muted; duplicate filenames cannot be confirmed. Test on - non-live output first. Already-muted players stay muted. Other module commands - are ignored while loading. The button follows the main; backup results are in - `backup_load_next_status` / `backup_load_next_detail`. See the README for limits. - **Mute**: red **MUTED** when the player mute switch is on. - **Pause**: amber while paused. - **Remaining / Elapsed**: live time with a progress bar (passive displays). @@ -37,6 +30,30 @@ 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. +## EXPERIMENTAL — Load next + +Find **EXPERIMENTAL — Load next (may briefly play video)** in the separate +**EXPERIMENTAL — test before use** preset section. **EXP** remains visible on +its button in all states, including success and offline. + +**This deliberately starts the next video and then tries to stop it. It is not +true paused loading, and moving video can briefly reach the output. It has passed +mock tests but has not yet been validated on the user's actual MPC-HC player.** + +It confirms mute, sends Next once and Stop immediately, retries Stop, and restores +the original mute state only after a changed filename stays stopped for 500 ms. +Already-muted players stay muted. Duplicate reported filenames cannot be verified. +Other module commands are ignored while it runs. The button follows the main; +backup results are in `backup_load_next_status` / `backup_load_next_detail`. + +**LOAD FAILED does not guarantee playback stopped.** Failed loading does not +restore audio; a lost response during final unmute leaves the mute outcome +uncertain. Inspect MPC-HC before manually unmuting or retrying. **LOADED NEXT** +is based on reported state, not proof of silent or seamless preload. + +Test on non-live output and read the README's experimental section before use. +Re-add existing copied presets to receive the EXP label; linked presets update. + ## Optional backup Configure a backup host and port to send commands to both players. Leave the host diff --git a/companion-modules/media-player-classic/src/definitions.js b/companion-modules/media-player-classic/src/definitions.js index 5efb1c2..59bb82e 100644 --- a/companion-modules/media-player-classic/src/definitions.js +++ b/companion-modules/media-player-classic/src/definitions.js @@ -27,7 +27,7 @@ export function actions(send, loadNext) { ) if (loadNext) definitions.load_next = { - name: 'Load next (experimental: mute, Next, Stop)', + name: 'EXPERIMENTAL — Load next (mute, Next, Stop)', options: definitions['887'].options, callback: (action) => loadNext(action?.options?.target ?? 'both'), } @@ -63,7 +63,10 @@ export function presets(label = 'MPC_DEV') { name, style: { text, size, color: colors.white, bgcolor, show_topbar: true }, steps: [{ down: id ? [{ actionId: id, options: { target: 'both' } }] : [], up: [] }], - feedbacks: [...feedback, offline], + feedbacks: [ + ...feedback, + id === 'load_next' ? { ...offline, style: { ...offline.style, text: 'EXP\nOFFLINE' } } : offline, + ], }) const transport = { transport_redundancy: { @@ -74,8 +77,8 @@ export function presets(label = 'MPC_DEV') { feedbacks: [{ feedbackId: 'redundancy', options: {} }], }, transport_load_next: button( - 'Load next (experimental)', - 'LOAD\nNEXT', + 'EXPERIMENTAL — Load next (may briefly play video)', + 'EXP\nLOAD\nNEXT', 'load_next', [{ feedbackId: 'load_next_status', options: {} }], 12, @@ -138,8 +141,9 @@ export function presetSections(buttons) { { id: 'transport', name: 'Transport & timing', - definitions: Object.keys(buttons).filter((id) => id.startsWith('transport_')), + definitions: Object.keys(buttons).filter((id) => id.startsWith('transport_') && id !== 'transport_load_next'), }, + { id: 'experimental', name: 'EXPERIMENTAL — test before use', definitions: ['transport_load_next'] }, { id: 'commands', name: 'All commands', definitions: Object.keys(commands) }, ] } diff --git a/companion-modules/media-player-classic/src/feedbacks.js b/companion-modules/media-player-classic/src/feedbacks.js index 5c0bd98..cffa589 100644 --- a/companion-modules/media-player-classic/src/feedbacks.js +++ b/companion-modules/media-player-classic/src/feedbacks.js @@ -91,7 +91,8 @@ export function feedbacks(getState, getSync = () => null, getLoadStatus = () => callback: () => { const status = getLoadStatus() return { - text: { loading: 'LOADING', ready: 'LOADED\nNEXT', failed: 'LOAD\nFAILED' }[status] ?? 'LOAD\nNEXT', + text: + 'EXP\n' + ({ loading: 'LOADING', ready: 'LOADED\nNEXT', failed: 'LOAD\nFAILED' }[status] ?? 'LOAD\nNEXT'), bgcolor: { loading: colors.amber, ready: colors.blue, failed: colors.red }[status] ?? 0x243b50, color: status === 'loading' ? colors.dark : colors.white, } diff --git a/companion-modules/media-player-classic/test/lifecycle.test.js b/companion-modules/media-player-classic/test/lifecycle.test.js index 44cdec4..0ff7f39 100644 --- a/companion-modules/media-player-classic/test/lifecycle.test.js +++ b/companion-modules/media-player-classic/test/lifecycle.test.js @@ -181,5 +181,5 @@ test('experimental preset runs on main with unavailable backup and exposes indep assert.equal(state.variables.load_next_status, 'ready') assert.equal(state.variables.backup_load_next_status, 'failed') assert.equal(state.statuses.at(-1), InstanceStatus.Ok) - assert.equal(state.feedbacks.load_next_status.callback().text, 'LOADED\nNEXT') + assert.equal(state.feedbacks.load_next_status.callback().text, 'EXP\nLOADED\nNEXT') })