musicblocks
musicblocks copied to clipboard
Save Mouse Artwork Animation (DRAFT)
This will be really great.
Do we also need to save in mp4 (part 2 of #1673 )?
@b18050 Yes. Currently, it only saves the mouse animation (without audio).
This draft is great.
What is left to be done with this?
@pikurasa It can only save the animation video, without the music. I thought of recording the music using the Recorder.js, then mux it together with the WEBM file, but according to another issue, the recorder breaks the synth. Thoughts?
This is actually pretty cool I must admit, And, the code is fairly simple.
@walterbender @pikurasa This PR's been here for a while. Time to merge this?
I've better ideas about superimposing the music. But that won't happen the way this has been implemented.
Fixed the merge conflicts, and tried a simple project. nothing fancy ... works fine.
One tiny issue: this won't record the last instruction's effect.
techincal reason: All our commands are dispatched as asynchronous events, which execute after the main queue. The instruction to stop recording executes after dispatching the last command's event, but it is part of the main queue. So, it executes before the event executes, i.e. the recording is stopped right after the event is dispatched and before the event is executed entirely.
Not really anything we can do about it without creating a mess.
I suppose we could land this in this cycle. I was waiting for the audio. (Makes more sense for Turtle Blocks than Music Blocks w/o the audio.)
Well, this recording uses HTMLCanvasElement
's captureStream
method, generating a MediaStream
. This works directly on the canvas
element.
Our .wav
/.ogg
audio download relies on MediaRecorder
, which in turn depends on Tone.js
's BaseContext.createMediaStreamDestination
method.
Another thing to observe is that canvas capturing happens every time the project is played (via Logo.runLogoCommands
). Audio recording happens when we decide to record audio. It might be possible to perform the superimposition, but then I'm not sure if it is worth the effort doing it this way at all. Plus, there are issues with codecs. I don't think it's easy to generate .mp4
by ourselves without using any library.
As a matter of fact, I'm opposed to using niche features of a platform without disconnected wrappers, which at the moment, we're doing extensively all throughout — one of the reasons why redesigning the architecture is a necessity.
I understand your motivation, but we probably don't have any easy way out at the moment.
I think we could either land this as a Turtle Blocks only feature or keep it on hold as we had been doing.
We landed something similar.