Voice notes drafts

This commit is contained in:
Alvaro 2023-03-02 13:55:40 -07:00 committed by GitHub
parent 356fb301e1
commit 99015d7b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 2113 additions and 909 deletions

View file

@ -92,8 +92,12 @@ class GlobalMessageAudio {
return this.#url;
}
get duration() {
return this.#audio.duration;
get duration(): number | undefined {
// the underlying Audio element can return NaN if the audio hasn't loaded
// we filter out 0 or NaN as they are not useful values downstream
return Number.isNaN(this.#audio.duration) || this.#audio.duration === 0
? undefined
: this.#audio.duration;
}
get currentTime() {