👉 Support this work via GitHub Sponsors
A lightweight major mode to open media (audio/video) files in an Emacs buffer.
This package isn’t on MELPA just yet. In the meantime, clone the repo or use the handy package-vc-install
(as of Emacs 29):
(package-vc-install "https://github.com/xenodium/ready-player" :last-release)
(require 'ready-player)
(ready-player-add-to-auto-mode-alist)
To customize supported media files, set ready-player-supported-media
before invoking ready-player-add-to-auto-mode-alist
.
You can combine the previous install/setup into something like the following:
(use-package ready-player
:init
(unless (package-installed-p (intern "ready-player"))
(package-vc-install "https://github.com/xenodium/ready-player" :last-release))
:config
(ready-player-add-to-auto-mode-alist))
ready-player-mode
relies on command line utilities to play media.
By default, ready-player-mode
will try to use either mpv
, vlc
, ffplay
, or mplayer
(in that order). Customize ready-player-open-playback-commands
to your preference.
Install either of these using your favorite method.
On macOS:
brew install mpv
Metadata is extracted using ffprobe
, which comes bundled with ffmpeg.
Install using your favorite method.
On macOS:
brew install ffmpeg
ready-player-mode
prefers ffmpegthumbnailer to generate thumbnails, but will fallback to ffmpeg
otherwise.
Install using your favorite method.
On macOS:
brew install ffmpegthumbnailer
Custom variable | Description |
---|---|
ready-player-supported-media | Supported media types. |
ready-player-play-icon | Play icon string, for example: “⏵”. |
ready-player-stop-icon | Stop icon string, for example: “■”. |
ready-player-open-externally-icon | Open externally icon string, for example: “➦”. |
ready-player-show-thumbnail | Whether or not to attempt to display a thumbnail. |
ready-player-open-playback-commands | Command line utilities to try for playback. |
By default, ready-player-mode
will try to use macOS SF Symbols (if available) for ready-player-play-icon
ready-player-stop-icon
and ready-player-open-externally-icon
.
You’ll need to enable SF symbol rendering in Emacs (before loading =ready-player.el=).
(when (memq system-type '(darwin))
(set-fontset-font t nil "SF Pro Display" nil 'append))
ready-player-add-to-auto-mode-alist | Add media recognized by `ready-player-mode’. | |
ready-player-stop | Stop media playback. | |
SPC | ready-player-toggle-play-stop | Toggle play/stop of media. |
ready-player-play | Start media playback. | |
ready-player-remove-from-auto-mode-alist | Remove media recognized by `ready-player-mode’. | |
o or e | ready-player-open-externally | Open visited file in default external program. |
ready-player-mode | Major mode to preview and play media files. | |
p | ready-player-previous-file | Visit the preceding image in the same directory as the current file. |
q | ready-player-quit | Quit `ready-player-mode’ window and kill buffer. |
g | ready-player-toggle-reload-buffer | Reload media from file. |
n | ready-player-next-file | Visit the next media file in the same directory as current file. |
TAB | ready-player-next-button | Navigate to next button. |
<backtab> | ready-player-previous-button | Navigate to previous button. |