EUR full-term totals: 1 month €8.99 · 3 months €21.99 · 6 months €35.99 · 12 months €49.99 Compare plans →
Menu

Player apps

Match mpv IPC replies with integer request identifiers

Avoid assigning a command result to the wrong local control action.

A player organises the experience

Give each pending action an identity

mpv's JSON IPC supports integer request identifiers echoed in replies. A local controller should associate each pending action with its own identifier. The next received object may be an event rather than the response the user is waiting for.

Keep a request map

For an authored design example, assign 41 to a position query and 42 to a pause-related query. Store the intended operation against each number, then route each reply by its identifier. Do not infer identity from arrival order when asynchronous actions or events can intervene.

Handle an error as a result for that same pending request. If the connection is lost, mark unresolved actions as uncertain rather than assigning the next reconnect message to an old button press. No controller was implemented or tested for this article.

Bound the trust assumption

Keep this mechanism on a trusted local endpoint. Request identifiers correlate messages; they are not authentication tokens and do not make mpv's IPC a secure network protocol. Record the player version and keep pending-state logs free of unnecessary private media paths.

Questions answered

Do request identifiers authenticate the controller?

No. They correlate responses and do not add authentication or encryption.

Can I use response arrival order as the only association?

Use explicit identifiers and separate event handling, especially with asynchronous commands.

Sources & further reading

Official references for the subjects discussed. Service terms and device software can change.

Your next step

A better setup starts with the right details.

Tell us your device model, viewing country and the programmes you want to discuss.

Talk on WhatsApp

+44 7532 814802

WhatsApp ↗↑ Top