Open ykh015 opened 4 years ago
How about this idea?
dictionary MediaBlobRange {
required long long startTime;
required long long endTime;
};
dictionary MediaBlobOperationOptions {
optional DOMString mimeType;
optional sequence<MediaBlobRange> splitRanges;
};
interface MediaBlobOperation {
...
Promise<sequence<MediaBlob>> finalize(optional MediaBlobOperationOptions options);
};
So to use the API, the developer would specify something like:
mbo.finalize( { splitRanges: [ { startTime: 0, endTime: 5 }, { start:Time: 5, endTime: 10 ]})
This would split the blob into two halves.
Potential advantages:
What do you think?
Looks very promising. One concern: If the user only specifies one splitRange like this:
mbo.finalize( { splitRanges: [ { startTime: 0, endTime: 5 } ] } )
will this return just one blob ? If yes, isn't it doing what trim()
here is designed to do ?
mbo.trim(0,5);
mbo.finalize();
And what would be the output for
mbo.finalize( { splitRanges: [ { startTime: 5, endTime: 8 } ] } )
Assuming total duration is 10ms, will three blobs [0,5), [5,8), [8,10) be returned ? Or just one blob from [5,8) ?
@SteveBeckerMSFT: Is there a way to enforce the that the spit operation should be last by making it impossible for the developer to call split before other operations?
For example, could we move split() to the MediaBlob interface? Or should we add a splitAndFinalize() method to the MediaBlob operation?
@ykh015: The proposed error checking on finalize() makes sure that split() if called is always the last operation called before finalize().
Do we still need to add more guardrails here ?
@SteveBeckerMSFT: Maybe we should add more guardrails if possible. It's more developer friendly to create an API that cannot be used incorrectly. What advantages do we gain by tying split() to MediaBlobOperation?
Originally posted by @SteveBeckerMSFT in https://github.com/WICG/video-editing/pull/9