Add array concat util (#9306)

This commit is contained in:
Michael Weimann 2022-09-21 20:06:05 +02:00 committed by GitHub
parent c182c1c706
commit 516b4f0ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 4 deletions

View file

@ -18,6 +18,7 @@ import { IEncryptedFile, MatrixClient } from "matrix-js-sdk/src/matrix";
import { SimpleObservable } from "matrix-widget-api";
import { uploadFile } from "../ContentMessages";
import { concat } from "../utils/arrays";
import { IDestroyable } from "../utils/IDestroyable";
import { Singleflight } from "../utils/Singleflight";
import { Playback } from "./Playback";
@ -148,10 +149,7 @@ export class VoiceMessageRecording implements IDestroyable {
private onDataAvailable = (data: ArrayBuffer) => {
const buf = new Uint8Array(data);
const newBuf = new Uint8Array(this.buffer.length + buf.length);
newBuf.set(this.buffer, 0);
newBuf.set(buf, this.buffer.length);
this.buffer = newBuf;
this.buffer = concat(this.buffer, buf);
};
private get audioBuffer(): Uint8Array {