dont re-prepare voice messages (#7897)
* dont reprepare voice messages Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug Signed-off-by: Kerry Archibald <kerrya@element.io> * test Playback Signed-off-by: Kerry Archibald <kerrya@element.io> * test RecordingPlayback Signed-off-by: Kerry Archibald <kerrya@element.io> * forgotten copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * add comments Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
@@ -133,6 +133,13 @@ export class Playback extends EventEmitter implements IDestroyable {
|
||||
}
|
||||
|
||||
public async prepare() {
|
||||
// don't attempt to decode the media again
|
||||
// AudioContext.decodeAudioData detaches the array buffer `this.buf`
|
||||
// meaning it cannot be re-read
|
||||
if (this.state !== PlaybackState.Decoding) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The point where we use an audio element is fairly arbitrary, though we don't want
|
||||
// it to be too low. As of writing, voice messages want to show a waveform but audio
|
||||
// messages do not. Using an audio element means we can't show a waveform preview, so
|
||||
|
||||
Reference in New Issue
Block a user