Mpv: Add option to always display OSC for audio-only?

Created on 7 Sep 2016  路  7Comments  路  Source: mpv-player/mpv

There needs to be an option to always display the onscreen controller when no video track is loaded.

(And, possibly, an option to always display the onscreen controller if the video track is merely cover art.)

mpv version and platform

2:0.19.0~trusty @ mpv-tests PPA

Mint 17.3 x64

Reproduction steps

  • Play music files

    Expected behavior

The OSC should stick around, or else it should be possible to configure it to do so.

Actual behavior

The OSC hides itself when the mouse is not present, and there is no way to override this behavior on the basis of video track presence.

Most helpful comment

For reference, this is a variation on @AirPort 's script which does "always OSC if only audio", and also sets it back to "auto" if you then load a video file (e.g. in a playlist).

Save this as audio-osc.lua at the scripts dir inside mpv config dir:

mp.register_event("file-loaded", function()
    local hasvid = mp.get_property_osd("video") ~= "no"
    mp.commandv("script-message", "osc-visibility", (hasvid and "auto" or "always"), "no-osd")
    -- remove the next line if you don't want to affect the osd-bar config
    mp.commandv("set", "options/osd-bar", (hasvid and "yes" or "no"))
end)

All 7 comments

You can set the OSC visibility as three different modes: always, auto (on mouse move) and never using:

  • Pressing the DEL key to cycle those.
  • Send a script message, e.g. at input.conf: a script-message osc-visibility never.
  • Using a command line or config value such as --script-opts=osc-visibility=always.

You'd need a relatively recent (two-three months) version of mpv for those.

[edit]
Actually it's been supported since February 2016.

Aha, thanks for telling me about the DEL key for that. That's definitely a suitable workaround.

The only thing remaining now is whether this can be automatically done for files which do not contain video (and, optionally, for files whose only video track is cover art.) And at that point, it's basically only a matter of convenience.

The only thing remaining now is whether this can be automatically done for files which do not contain video (and, optionally, for files whose only video track is cover art.) And at that point, it's basically only a matter of convenience.

Not out of the box, but it should be possible with a small lua script.

I "wrote" a script a couple of weeks ago pretty much for the same user case. I use it with audio-display=no (I don't like cover art visualization too much), and if it detects no video it sends the osc-visibility=always message and it prints the audio file's metadata in the player's window.
I'm by no means a developer so it's really, really rough, probably not too much efficient and there are a couple of corner cases in mixed playlists which make it behave not so well, but I use it on a daily basis and it does its job, and maybe an actual dev can get something decent out of it.

+1 on this, would love it to be a built-in default

For reference, this is a variation on @AirPort 's script which does "always OSC if only audio", and also sets it back to "auto" if you then load a video file (e.g. in a playlist).

Save this as audio-osc.lua at the scripts dir inside mpv config dir:

mp.register_event("file-loaded", function()
    local hasvid = mp.get_property_osd("video") ~= "no"
    mp.commandv("script-message", "osc-visibility", (hasvid and "auto" or "always"), "no-osd")
    -- remove the next line if you don't want to affect the osd-bar config
    mp.commandv("set", "options/osd-bar", (hasvid and "yes" or "no"))
end)

should be done via a script which also already exists.

Was this page helpful?
0 / 5 - 0 ratings