feoblog icon indicating copy to clipboard operation
feoblog copied to clipboard

Support audio attachments

Open NfNitLoop opened this issue 4 years ago • 2 comments

Support audio recording in the client.

https://blog.addpipe.com/recording-audio-in-the-browser-using-pure-html5-and-minimal-javascript/ has some example code for reference.

Depends on File attachments working: (#4)

I'll probably also need to add some Item metadata to say that "this attachment is audio meant to be played inline", since unfortunately .ogg and .webm file extensions are not exactly unambiguous there.

NfNitLoop avatar Feb 12 '21 01:02 NfNitLoop

I'll probably also need to add some Item metadata to say that "this attachment is audio meant to be played inline", since unfortunately .ogg and .webm file extensions are not exactly unambiguous there.

I'm leaning toward using Opus as the default audio codec, since it seems to be the clear winner in most aspects:

And, since the recommended file extension for an Opus stream in an Ogg container is .opus, that makes it pretty unambiguous that it's an audio file.

I'll likely just update the client (And maybe even the plain HTML version) to render .opus (and maybe also .m4a) files in an <audio> element with default controls.

The main problem I'm running into now is that, when I use MediaRecorder to create the .opus file, neither Chrome nor Firefox know its length until the end of the file is reached. They also fail to seek within the file.

My hope is that they'll eventually add that functionality, since it is possible to seek, according to the RFC. It seems that browsers just haven't implemented the bisect search to do so? Maybe there are plans to add it?

NfNitLoop avatar Apr 07 '21 21:04 NfNitLoop

Pausing this work. I'll upload an audio branch that contains my work so far.

In it, I'm able to record an Ogg/Opus file via WASM in FF/Chrome/Safari. But Safari can't playback opus audio in an .ogg file, it wants a proprietary .caf file container. 🙄 Boooo, Apple.

I briefly investigated https://github.com/audiocogs/aurora.js/ to decode in the browser, but npm install av is unable to complete on my Windows workstation.

Another option would be to transcode the .opus (Ogg/Opus) file to a .caf (CoreAudioFile/Opus) file before playback in Safari, but I didn't see anything that does that out of the box either.

NfNitLoop avatar Jun 13 '21 00:06 NfNitLoop