Send reply to browser and suppress output from mpv #2

Merged
Gobbel2000 merged 2 commits from improvements into main 2023-04-10 01:59:50 +02:00
Gobbel2000 commented 2023-04-09 18:12:11 +02:00 (Migrated from github.com)

Sending the "ok" message (including the quotes for a JSON-formatted string) back to the browser prevents the Error: An unexpected error occurred lines in the browser console.

The output of mpv is suppressed so that it doesn't get read by the browser which then tries to parse it as JSON messages. Apart from also reducing log clutter, this change seems to have fixed a behavior where closing the browser also killed the mpv instance. This is only relevant when the --no-terminal option is unset. Maybe this option should be set by default, but I think the current way is fine as well where it's up to the user and you could technically even use a different player than mpv.

Sending the `"ok"` message (including the quotes for a JSON-formatted string) back to the browser prevents the `Error: An unexpected error occurred` lines in the browser console. The output of mpv is suppressed so that it doesn't get read by the browser which then tries to parse it as JSON messages. Apart from also reducing log clutter, this change seems to have fixed a behavior where closing the browser also killed the mpv instance. This is only relevant when the `--no-terminal` option is unset. Maybe this option should be set by default, but I think the current way is fine as well where it's up to the user and you could technically even use a different player than mpv.
ryze312 commented 2023-04-10 01:59:16 +02:00 (Migrated from github.com)

Thanks for the PR!
I've actually tested to see if the error message appears in console on Firefox 111, maybe it did in the earlier versions though. Whatever the case I included the reply function in code, but forgot to actually call it.

Suppressed log is great! Closing browser should not affect the mpv, since it is a detached process, tested as well.

Thanks for the PR! I've actually tested to see if the error message appears in console on Firefox 111, maybe it did in the earlier versions though. Whatever the case I included the reply function in code, but forgot to actually call it. Suppressed log is great! Closing browser should not affect the mpv, since it is a detached process, tested as well.
Sign in to join this conversation.
No description provided.