mpv.el
mpv.el copied to clipboard
Improve feedback when attempting to play from unreachable URL
Is the reason for mpv--url-reachable-p that you want to give friendly feedback to the user if playback fails (instead of just silently doing nothing)?
Yes, it seemed like a simple enough check to synchronously make the user aware of invalid/unreachable URLs, and fail fast in case there is no network connection available as well. The immediate downside I can see with it, is that the code does a full GET request for the given URL, so it does load the full response body into a temporary buffer, without added protection/security, in case that would be a concern. (A HEAD request would safeguard this a bit more, but I couldn't find an easy way to do this in Emacs without adding libraries or lots of extra code on top :smile:)
With the hook approach, don't we lose the semantics of what exactly caused the failure, e.g. malformed, unreachable, invalid file format, ...? I assume mpv will simply treat is as a file-loading exception (which, within its context, is completely reasonable), but I could be wrong. I'll look further into the man pages for
mpv
, as I don't have much knowledge of it beyond simple usage
Originally posted by @detvdl in https://github.com/kljohann/mpv.el/issues/14#issuecomment-798174930