Hooks
Every filter and action Riff fires, in PHP and in the player. Each page is generated from the docblock above the line the hook fires on, at the commit this site was published from. A hook keeps its name and parameters within a major version.
PHP filters
- riff_about_sections
Filters the sections of the About panel, Riff's own included:
track, the cover, the title and the artist and album, andcredits, what the file's tags say about who made it. - riff_can_play
Filters whether the current visitor may play a track.
- riff_enabled
Filters whether Riff's player loads on the current front-end request.
- riff_extensions
Filters the extensions Riff loads, by name: a host can leave one out, or name another plugin it has placed in Riff's extensions/ folder.
- riff_protect_storage
Filters whether the storage a file is kept in elsewhere was made private, when it is protected, or public again, when it isn't. A plugin that keeps uploads in object storage or on a CDN answers for its own files: true once the copy there is private (or public again), or a WP_Error to say why it couldn't be, which the Media Library shows. Without an answer, a file only on this server is moved into the protected folder, and one kept elsewhere is not protected, as moving it would leave it public there. Riff can't send a file it doesn't have, so a plugin that protects its files signs their addresses through riff_protected_url too.
- riff_protected_send
Filters how a protected file is handed over: 'php' sends it from PHP; 'x-sendfile' asks Apache's mod_xsendfile or LiteSpeed to send it; 'x-accel-redirect' asks Nginx, which then needs an internal location for the protected folder (see the readme).
- riff_protected_url
Filters the address a protected file is sent from instead of WordPress: a signed address on a CDN or in object storage, such as a CloudFront or S3 presigned URL or a Bunny or Cloudflare token, that stops working at $expires. Riff has checked that the visitor may have the file before it asks, and sends them on with a 302 nothing caches. Empty, the default, sends the file as riff_protected_send says.
- riff_sources
Filters the sources tracks are read from, keyed by id.
- riff_together_share
Filters whether a listener who hasn't chosen shares what they play with the site's other listeners. A site where listeners shouldn't see each other unless they ask, a class of children say, returns false.
- riff_track
Filters a track before the player reads it.
- riff_turntable
Filters whether Now Playing shows the record and the turntable. Off, it shows the cover on its own, and a touch screen on its side shows the cover beside the controls.
- riff_unlock_url
Filters where a locked track sends the visitor to unlock it: a sign-up, membership or checkout page.
- riff_video_first
Whether a song that has a video opens as the video. A listener's own choice of the song or the video, and a browser that saves data, come first.
PHP actions
- riff_before_player
Fires before the player's markup.
- riff_register
Fires once a request, before the player's controls and views are first read: register them here with
riff_register_control()andriff_register_view(), or take one of Riff's own away.
JavaScript filters
- riff.queue
Filters the tracks about to become the queue.
- riff.shortcuts
Filters whether the single-key shortcuts (Space, K, J, L) act on a key press.
- riff.track
Filters one track as a queue is set, after
riff.queue.
JavaScript actions
- riff.ended
Fires when a track plays to its end, before the next one loads.
- riff.pause
Fires when the track pauses.
- riff.play
Fires when the track starts or resumes playing.
- riff.queue
Fires when the queue changes while it plays: tracks added to play next or at the end, one moved or removed, or the queue cleared.
- riff.ready
Fires once the player is set up, its state restored and
window.riffavailable. - riff.time
Fires as the track plays, a few times a second, and again after a seek.
- riff.track
Fires when a track is loaded, before it plays.
- riff.view
Fires when a view opens or closes, Riff's own included, and again for an open view when the track changes. A view's script fills it here, or in the
renderit was given.
No hook matches.