PresentationWaveform

Minimal audio player with region lane for presentation (read-only) mode.

Constructor

new PresentationWaveform(mountEl, ctrl, callbacks)

Parameters:
NameTypeDescription
mountElHTMLElementContainer element to render the player into.
ctrlPresentationControllerShared controller for hover/select state.
callbacksobjectEvent callbacks.
Properties
NameTypeDescription
onRegionHoverfunctionCalled with segment index when hovering a region.
onRegionSelectfunctionCalled with segment index when a region is clicked.
onRegionActivatefunctionCalled with segment index when playhead enters a region.

Methods

drawRegions()

Repaints the region canvas, drawing one bar per segment coloured by speaker and sized/highlighted according to active, hovered, and selected state.

loadFromProject(project)

Initialises WaveSurfer and loads audio from the given project.
Parameters:
NameTypeDescription
projectProjectThe project whose waveform should be loaded.

setHoveredRegion()

Triggers a region redraw after the hovered segment changes.

setSelectedRegion(idx)

Seeks to the selected segment and triggers a region redraw.
Parameters:
NameTypeDescription
idxnumberSegment index to select and seek to.