emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a way to not close mpv window on next/prev because exwm


From: Mike Kazantsev
Subject: Re: a way to not close mpv window on next/prev because exwm
Date: Fri, 20 Nov 2020 10:59:59 +0500

On Fri, 20 Nov 2020 01:19:34 +0100
Stefan Huchler <stefan.huchler@mail.de> wrote:

> I try to manage video files over emms which generally works the problem
> is when it closes the window each time a new file starts the window pops
> directly in my current frame because I use exwm, instead of staying in
> the other frame on the other monitor so is there a way to not close the
> window for changing to the next file?

I'd try adding following options to emms-player-mpv-parameters:

  --force-window=immediate --keep-open=always

And in general, check out mpv manpage, it has a lot of configuration
for how/where/when its video playback window is presented.


> I used umpv before which should be included in the mpv package that way
> it adds files instead of starting now windows. Not sure if there are
> other ways to keep the window open, but I think you could if you detect
> end of file instead of closing clear playlist and at current file in and
> start playback?
> 
> Would that be a new player backend or would a few modifications to the
> mpv backend be enough?

Should be possible to do with this backend, but I think Yoni is right
about extra work for syncing it.

Currently emms-player-mpv-start runs "loadfile" with just a file
argument to start a new track once mpv indicates that playback
finished, and doesn't use playlist functionality on the mpv side at all -
playlist is kept in emms and it just tells mpv what file to play and when.


But "loadfile" command has following spec (from mpv manpage):

  loadfile <url> [<flags> [<options>]]
    Load the given file or URL and play it.
    Second argument:
    <replace> (default)
      Stop playback of the current file, and play the new file immediately.
    <append>
      Append the file to the playlist.
    <append-play>
      Append  the  file,  and if nothing is currently playing, start playback.
      (Always starts with the added file, even if the playlist was not empty 
before running this command.)
    The  third  argument  is  ...

So it is possible to append entries to playlist on the mpv side
and check/remove them in whatever ways as well.

I think you'd either want to add such entries at least couple seconds
before previous one finishes, or synchronize playlist and playback
position between emms and mpv entirely (i.e. when something added/removed
from emms playlist, change is instantly propagated to mpv).


First option - adding entries before playlist ends - can probably be
due by adding a check/hook to playback time updates in emms, and enabling
emms-player-mpv-update-duration.

Another option would be to always add one playlist entry ahead of one
playing, and a hook to remove that if it's gone from emms playlist,
but not sync the entire thing otherwise.


And for syncing whole playlist, guess you'd want to use loadlist +
loadfile + playlist-remove + playlist-move and such to do it.

It's probably easier that it sounds - just write one function to fetch
whole playlist from mpv and generate/send commands to synchronize it,
and then run that on any emms playlist changes.


If simple display options suggested above work though, maybe such
modifications shouldn't be necessary, but if you'll come up with an
algorithm to manage playback that way, might be worth merging it into
the backend too, as it'd allow using mpv prefetching options - e.g.
have playlist of videos on slow network media or youtube links that
would be prefetched and cached by mpv while previous file is still playing.


-- 
Mike Kazantsev // fraggod.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]