Re: [mediacapture-record] Creation of Seekable Files

@SingingTree 
> Regarding the muxer specific nature: is your concern that a 
finalise() style function, or indicating that a data will not be read 
back until completion, is not enough to allow for all muxers to handle
 this case?

Aside from the concerns already mentioned, adding a `finalise()`-like 
function would face some operational issues spec-wise. Two cases:
1. the user doesn't mind the UA holding on to the data for as long as 
needed, and indicates that by calling `start()` with no `timeslice`; 
at first sight, this situation would allow the implementation to 
rewrite the cues/length appropriately since it holds on to all the 
data, right? The problem here is that 
[`requestData()`](https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-requestdata)
 can be called at any time, flushing any internal memory, and dumping 
us into case 2.
2. to add a `finalise()` method we would need to specify what data is 
passed into it, e.g. should this method be passed as parameter the 
whole bag of `Blob`s received in `ondatavailable`? Or just some 
`Blob`s marked in some particular way...? Different container formats 
might need to rewrite different chunks of the output, so If the answer
 is 'the whole bag` then please read on...

> In the case of the polyfill, would this have no official relation 
this spec, but could be included by pages using media recorder to 
rewrite the results of their recording to contain cues? Would there be
 a need for the file to already have cues written, in the sense that 
it's a strict move operation, or would it handle writing cues in files
 that didn't have any?

Yeah, in this case the polyfill would be a node.js package that would 
be informatively linked from this very spec, and would consist of a 
single function call that gets the whole set of recorded `Blob`s and 
passes it through the mentioned function 
([`CopyAndMoveCuesBeforeClusters`](https://cs.chromium.org/chromium/src/third_party/libwebm/source/mkvmuxer/mkvmuxer.h?type=cs&q=CopyAndMoveCuesBeforeClusters&sq=package:chromium&l=1630)),
 that tries to "clean up" the webm/mkv, so that it has correct 
`Duration`, `Cues` and a bunch of other things. IIRC, it can create 
the `Cues` from scratch. IIUC, it's very much the equivalent of 
[`mkclean`](https://www.matroska.org/downloads/mkclean.html) for webm 
files.

A similar informative-thingy would be to use WebAudio to mix several 
audio tracks before passing them to Media Recorder: it's not strictly 
part of this Spec, but it's good to have an informative example 
detailing this... (either in the Spec, in MDN or in both).


-- 
GitHub Notification of comment by miguelao
Please view or discuss this issue at 
https://github.com/w3c/mediacapture-record/issues/119#issuecomment-283846800
 using your GitHub account

Received on Friday, 3 March 2017 02:25:22 UTC