SonicFrame v1.3.2

The minimap

While zoomed in, a strip shows the whole sound, the played part and a box over the part in view. Drag the box to move, click beside it to jump there.

Adding it

import { minimap } from 'sonicframe';

new SonicFrame({
    container,
    media,
    peaks,
    zoom: { wheel: true, keys: true },
    plugins: [minimap({ a11y: { keys: true } })],
});

On the player, it is one option: minimap: true, or its options.

A press on the strip never seeks: it only moves the view.

Options

Option Default What it does
placement 'below' 'above' or 'below' the wave.
height 24 The strip's height, at least 4: a number in CSS pixels, or a length with its unit ('1.5rem', '24px'). The player's minimapHeight is in rem.
gap 4 Space between the strip and the wave, at least 0: a number in CSS pixels, or a length with its unit ('0.25rem').
cursors hands { box, moving, beside }: 'grab', 'grabbing', 'pointer'.
wave, bar thin bars How the sound is drawn in the strip.
colors the theme's { wave, progress, view, edge }.
progress true Paints the played part.
controls.drag, controls.click true Dragging the box and clicking beside it move the view.
controls.wheel false The wheel over the strip zooms.
autoHide false Takes no room while the whole sound is in view.
a11y.keys false Makes it a keyboard slider; off, it is hidden from screen readers.
a11y.words.label 'Visible part' Its accessible name, in the frame's language.
a11y.words.value the frame's language Its value: a phrase with {from}, {to} and {total} ('{from} to {to} of {total}', "0:25 to 0:50 of 1:40"), or a function (from, to, total) => string.

Colors

The box takes --sonicframe-minimap-view and its edges --sonicframe-minimap-edge, which fall back to the region and played colors, so every theme and palette dresses it.

With the keyboard

With a11y.keys, the strip is a slider of the part in view: arrows move a quarter of the view, Page Up and Page Down a whole view, Home and End go to the ends, and its value says the part in words. A press on it also gives it the focus.

minimap({
    placement: 'above',
    height: '1.5rem',
    a11y: {
        keys: true,
        words: { label: 'Part in view', value: '{from} to {to} of {total}' },
    },
});