mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-29 14:51:17 +00:00
recording video turns screen red
This commit is contained in:
parent
9380590ff5
commit
6ad685f375
@ -116,8 +116,8 @@ function recordVideo(intervalMsec, maxFrames, callback) {
|
||||
console.log('finished encoding GIF');
|
||||
callback(blob);
|
||||
});
|
||||
intervalMsec = intervalMsec || (100 + ((Math.random()*16)&15));
|
||||
maxFrames = maxFrames || (100 + ((Math.random()*16)&15));
|
||||
intervalMsec = intervalMsec || (100 + ((Math.random()*256)&3));
|
||||
maxFrames = maxFrames || (100 + ((Math.random()*256)&15));
|
||||
var nframes = 0;
|
||||
console.log("Recording video", canvas);
|
||||
var f = () => {
|
||||
|
10
src/ui.ts
10
src/ui.ts
@ -896,7 +896,9 @@ function setWaitDialog(b : boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
var recordingVideo = false;
|
||||
function _recordVideo() {
|
||||
if (recordingVideo) return;
|
||||
loadScript("gif.js/dist/gif.js", () => {
|
||||
var canvas = $("#emulator").find("canvas")[0] as HTMLElement;
|
||||
if (!canvas) {
|
||||
@ -925,19 +927,23 @@ function _recordVideo() {
|
||||
_resume();
|
||||
$("#videoPreviewModal").modal('show');
|
||||
});
|
||||
var intervalMsec = 17;
|
||||
var maxFrames = 420;
|
||||
var intervalMsec = 33;
|
||||
var maxFrames = 200;
|
||||
var nframes = 0;
|
||||
console.log("Recording video", canvas);
|
||||
$("#emulator").css('backgroundColor', '#cc3333');
|
||||
var f = function() {
|
||||
if (nframes++ > maxFrames) {
|
||||
console.log("Rendering video");
|
||||
$("#emulator").css('backgroundColor', 'inherit');
|
||||
setWaitDialog(true);
|
||||
_pause();
|
||||
gif.render();
|
||||
recordingVideo = false;
|
||||
} else {
|
||||
gif.addFrame(canvas, {delay: intervalMsec, copy: true});
|
||||
setTimeout(f, intervalMsec);
|
||||
recordingVideo = true;
|
||||
}
|
||||
};
|
||||
f();
|
||||
|
Loading…
Reference in New Issue
Block a user