There are two parts to this change:
1. The computation of peaks is moved from `MessageAudio` to the
`GlobalAudioContext` and thus we can limit the concurrency of the
computations (`p-queue`!) and de-duplicate the computations as well
2. While the peaks are computed the component has to display spinning
animation instead of empty waveform and unclickable UI.
The currently pinned version of `node-gyp` requires Python 2. Python 2
has reached its EOL a long time ago and is unsupported by upstream.
The requirement on Python 2 is also an unnecessary barrier for new
developers to contribute to Signal.
This changeset updates the required version of node-gyp to one
compatible with Python 3.
`CONTRIBUTING.md` remains unchanged, since this dependency was not
previously mentioned anyway.
Supersedes #4407Fixes#4783
It is practically impossible to rewind audio prior to this commit. With
this commit - clicking first two bars will rewind the audio to its very
start instead of updating its current play time to a specific non-zero v
alue.
`useMemo()` doesn't guarantee that the value won't be recomputed during
re-renders. Unfortunately, every time `AudioContext` is instantiated -
there is an audible click. This click happens during the change between
conversations and is very annoying.
Move both `AudioContext` instance to the
GlobalAudioContext's top-level declarations, and `Audio`/`WaveformCache`
to `useRef()`s.
Introduce new UI and behavior for playing audio attachments in
conversations. Previously, playback stopped unexpectedly during window
resizes and scrolling through the messages due to the row height
recomputation in `react-virtualized`.
With this commit we introduce `<GlobalAudioContext/>` instance that
wraps whole conversation and provides an `<audio/>` element that
doesn't get re-rendered (or destroyed) whenever `react-virtualized`
recomputes messages. The audio players (with a freshly designed UI) now
share this global `<audio/>` instance and manage access to it using
`audioPlayer.owner` state from the redux.
New UI computes on the fly, caches, and displays waveforms for each
audio attachment. Storybook had to be slightly modified to accomodate
testing of Android bubbles by introducing the new knob for
`authorColor`.