-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canvas Recording and Video resolution change #446
Conversation
Canvas Recording and Video resolution change
@jywarren , @TildaDares and @stephaniequintana may I please have your reviews on this PR ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, @Forchapeatl! I left some questions and a couple ideas. Thank you!
@@ -228,4 +230,67 @@ module.exports = function Interface(options) { | |||
$("[rel=popover]").popover() | |||
return true; | |||
}); | |||
|
|||
//Start Handle multiple webcam resolutions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I think it's important to say what we're changing the resolution of: the incoming video stream? The canvas? The outgoing saved video?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Forchapeatl what do you think about this function name? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I don't see the change, did you commit it?
const stream = canvas.captureStream(); // grab our canvas MediaStream | ||
const rec = new MediaRecorder(stream); | ||
|
||
function exportVid(blob) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. It's convenient for this all to be near the interface code, but do you imagine a possible future reorganization where it could live in... i'm not sure, the /src/io/ folder? Somewhere else? Since it's not technically part of the interface. We don't have to think about this yet, but we could put a comment in here to eventually move it, or open an issue to think about this in the future.
const ctx = canvas.getContext('2d'); | ||
var x = 0; | ||
const stream = canvas.captureStream(); // grab our canvas MediaStream | ||
const rec = new MediaRecorder(stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this cost any performance to start here, i.e. should we think about only setting this up if people start using video? Or, is it OK and not too much computational work?
src/ui/interface.js
Outdated
changeResolution('800px','600px') | ||
}); | ||
$('#hd').click(function(e){ | ||
changeResolution('2400px','1800px') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, here, should we stick to a standard definition of HD? This table was kind of helpful... we might say "720 HD" or "1080 HD"?
https://en.wikipedia.org/wiki/List_of_common_resolutions#Digital_Standards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you addressed this! 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done as requested
$('#startRecord').click(function(e){ | ||
const chunks = []; | ||
|
||
rec.ondataavailable = e => chunks.push(e.data); | ||
rec.onstop = e => exportVid(new Blob(chunks, {type: 'video/h264'})); | ||
rec.start(); | ||
document.getElementById('startRecord').style.display='none'; | ||
document.getElementById('stopRecord').style.display='block'; | ||
}) | ||
$('#stopRecord').click(function(e){ | ||
rec.stop(); | ||
document.getElementById('stopRecord').style.display='none'; | ||
document.getElementById('startRecord').style.display='block'; | ||
document.getElementById('downloadButton').style.display='block'; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a whole, it's functioning well when I test it. My only suggestion would be to consider changing the background color of the record button to red while recording. Perhaps in addition to toggling the display from none/block we can add that here. Great job, @Forchapeatl 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the color change idea. For accessibility, it's often a good idea to
change the icon of the button too, or to invert the colors, so the icon is
dark and the background light (or reverse depending). That way it still
works for folks who don't see colors the same way. You could make a CSS
class which overrides the styles and toggle that class in jQuery, or you
could swap a FontAwesome icon by changing the classname.
…On Mon, Aug 15, 2022 at 2:25 PM Stephanie Quintana ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/ui/interface.js
<#446 (comment)>:
> + $('#startRecord').click(function(e){
+ const chunks = [];
+
+ rec.ondataavailable = e => chunks.push(e.data);
+ rec.onstop = e => exportVid(new Blob(chunks, {type: 'video/h264'}));
+ rec.start();
+ document.getElementById('startRecord').style.display='none';
+ document.getElementById('stopRecord').style.display='block';
+ })
+ $('#stopRecord').click(function(e){
+ rec.stop();
+ document.getElementById('stopRecord').style.display='none';
+ document.getElementById('startRecord').style.display='block';
+ document.getElementById('downloadButton').style.display='block';
+ })
As a whole, it's functioning well when I test it. My only suggestion would
be to consider changing the background color of the record button to red
while recording. Perhaps in addition to toggling the display from
none/block we can add that here. Great job, @Forchapeatl
<https://github.com/Forchapeatl> 🚀
—
Reply to this email directly, view it on GitHub
<#446 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J4A6QKV3XBEUOTA5QDVZKDQNANCNFSM56NZK7CQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
used standard definition of HD
used standard definition of HD
Included boolean variables
Changed Icon color while recording
Changed icons for recording control
used requested indentation on boolean variables
@jywarren this PR is ready to merge. May I ? |
Hi @Forchapeatl I had not yet approved this one because i wanted to know your views on the questions above - can you reply up there? I'd like to hear from you on each of them, and had hoped for the function |
Sorry about that @jywarren , I didn't realize my poor actions. For this behavior I am very sorry. It wont happen again. |
No worries! Let me know what your responses are to the questions!
…On Fri, Aug 19, 2022, 8:47 PM FORCHA ***@***.***> wrote:
Hi @Forchapeatl <https://github.com/Forchapeatl> I had not yet approved
this one because i wanted to know your views on the questions above - can
you reply up there? I'd like to hear from you on each of them, and had
hoped for the function changeResolution to be changed in this PR. No
worries, these weren't critical changes, but please do your best to respond
to questions and clarifications before merging, thank you!
Sorry about that @jywarren <https://github.com/jywarren>
—
Reply to this email directly, view it on GitHub
<#446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J33FNYYK2UYMKDJF4DV2ATJVANCNFSM56NZK7CQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Canvas Recording and Video resolution change
Fixes #418
fount at https://forchapeatl.github.io/infragram/indexs.html
Passed Test Case
Failed Test Case
a0e9f751-ee48-40f2-9ec3-02b215c9.mp4
Make
sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
@publiclab/reviewers
for help, in a comment below