Constructor
new AudioPane(audioContext, options)
Create an audio pane.
Parameters:
| Name | Type | Description |
|---|---|---|
audioContext |
Object | An AudioContext. |
options |
Object | Configuration options. |
Methods
activate()
Activate this pane, allowing it to accept pointer events.
activateKeyboardInput()
Activate keyboard controls for player playing, pausing, stopping, and skipping.
addScheduledBufferPlayer()
Add the specified scheduled player.
cancelPlayIndicators()
Cancel the animation of the play indicator.
deactivate()
Deactivate this pane, preventing it from accepting pointer events.
deactivateKeyboardInput()
Deactivate keyboard controls.
deleteAllScheduledBufferPlayers()
Delete all scheduled buffer players.
deleteScheduledBufferPlayer()
Delete the scheduled player specified by its time vale.
draw()
Draw this AudioPane. Note that this pane has no visual component other than the audio playback progress indicator
which only appears when the player is playing or paused.
drawPanel()
Draw the panel for this pane.
drawPlayIndicator()
Draw the animated play indicator.
erasePanel()
Erase the panel for this pane.
getDuration()
Get the duration of the player for this pane
getElapsedTime()
Get the elapsed time in seconds since the last call to this method.
getPlayerTime()
Get the total playback time of the player for this pane.
hasPlayer() → {boolean}
Determine whether this AudioPane has a player set.
Returns:
Whether a player has been added.
- Type
- boolean
initialize(parentElement, width, height, timeScale)
Initialize this AudioPane.
Parameters:
| Name | Type | Description |
|---|---|---|
parentElement |
Element | The parent element. |
width |
number | The parent width. |
height |
number | The parent height. |
timeScale |
d3.scaleLinear | The time scale. |
initializePanel(panelElement)
Initialize the panel for this pane, setting its parent element to the specified element.
Parameters:
| Name | Type | Description |
|---|---|---|
panelElement |
element | The parent element. |
isPlaying() → {boolean}
Determines whether the player is playing or paused.
Returns:
True if the player is playing or paused, false otherwise
- Type
- boolean
(async) isReady()
Determines whether a buffer has been decoded and is ready to play.
lower()
Lower this pane to the bottom of the list of panes in its containing TimeFrame.
onPlayerEnded()
Run this method when the player for this pane has ended.
pause()
Pause the player for this AudioPane.
play()
Play the player for this AudioPane.
playOrPause()
Play the player if it's stopped or paused; pause otherwise.
playScheduledBufferPlayers()
Play scheduled buffer players. Note that only buffer players scheduled after the current playback time will play.
raise()
Raise this pane to the top of the list of panes in its containing TimeFrame.
resetAudioButtons()
Reset the built-in control buttons to their starting state.
resetTimeRange()
Resets the time range to start at zero and end at the duration of the player.
setAudioButtonsToPlaying()
Set the built-in control buttons to a playing state.
setPlayButtonToPaused()
Set the built-in control buttons to a paused state.
setTimeRange(start, stop)
Set the time range for playback.
Parameters:
| Name | Type | Description |
|---|---|---|
start |
number | The start time. |
stop |
number | The end time. |
skip()
Skip player playback to the specified time. If the player is playing, skip to that time and keep playing.
skipToNextScheduledBufferPlayer()
Skip to the next scheduled player.
skipToPreviousScheduledBufferPlayer()
Skip to the previously scheduled player.
stop()
Stop player. This will cancel the play indicator, stop any buffers scheduled after the stopping time,
and reset the control buttons.
stopScheduledBufferPlayers()
Stop all scheduled buffer players.
switchScheduledAudio()
Switch playback of scheduled buffers on and off.