diff --git a/public/index.html b/public/index.html index a421347..eb61880 100644 --- a/public/index.html +++ b/public/index.html @@ -2868,6 +2868,11 @@ const audioMode = audioField.audio_mode; const audioBytes = audioField.audio_bytes; + // handle opus: AM_OPUS_OGG + if(audioMode === 0x10){ + return this.decodeOpusAudioToBlobUrl(audioField.audio_bytes); + } + // determine codec2 mode, or skip if unknown const codecMode = this.lxmfAudioModeToCodec2ModeMap[audioMode]; if(!codecMode){ @@ -2898,6 +2903,26 @@ return null; } }, + async decodeOpusAudioToBlobUrl(audioBytes) { + try { + + // convert base64 to uint8 array + const opusAudioBytes = this.base64ToArrayBuffer(audioBytes); + + // create blob from opus audio + const blob = new Blob([opusAudioBytes], { + type: "audio/opus", + }); + + // create object url for blob + return URL.createObjectURL(blob); + + } catch(e) { + // failed to decode opus audio + console.log(e); + return null; + } + }, }, computed: { isMobile() {