I've looked around a bit and I think your best bet is to go the javascript route. It might not be as hard as it seems at first.
Use the mediarecorder api, which I assume is what the plugin also uses under the hood
developer.mozilla.org/en-US/docs/Web/API/MediaRecorder
Specifically note this part
MediaRecorder.start()
Begins recording media; this method can optionally be passed a timeslice argument with a value in milliseconds. If this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk.
So you can specifiy to automatically record chunks of 1 second. Every second from then on will fire the dataavailable event.
Within this event you can store the created data chunks however you please (e.g. an array of 30 for 30 seconds of recording)
Then when the user requests the highlight you can combine them like so (and I think this should generate a blob url that you can then invoke a download on)
function play() {
var superBuffer = new Blob(recordedChunks);
}
It's basically what citron2010 suggested but handling it in js is going to be much easier than doing some roundabout way in events.
EDIT: It should also avoid the issue with requesting permission. This should only request permission once, when the recording starts. After that it's just a continous recording, that you can tap in at any given moment to extract the last 30 seconds from.