Skip to content
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

Merged
merged 11 commits into from
Aug 19, 2022
Merged

Conversation

Forchapeatl
Copy link
Collaborator

@Forchapeatl Forchapeatl commented Aug 13, 2022

Canvas Recording and Video resolution change
Fixes #418
fount at https://forchapeatl.github.io/infragram/indexs.html
Passed Test Case

  • Resolution Change.
  • Canvas Recording.

Failed Test Case

  • Canvas assumes wrong size upon full screen exit.
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!

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

Canvas Recording and Video resolution change
@gitpod-io
Copy link

gitpod-io bot commented Aug 13, 2022

@Forchapeatl
Copy link
Collaborator Author

@jywarren , @TildaDares and @stephaniequintana may I please have your reviews on this PR ?

Copy link
Member

@jywarren jywarren left a 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
Copy link
Member

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?

Copy link
Member

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!

Copy link
Member

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) {
Copy link
Member

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);
Copy link
Member

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?

changeResolution('800px','600px')
});
$('#hd').click(function(e){
changeResolution('2400px','1800px')
Copy link
Member

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

Copy link
Member

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! 👍🏽

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as requested

Comment on lines +278 to +292
$('#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';
})
Copy link
Collaborator

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 🚀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before Recording

Screenshot from 2022-08-17 13-08-38

During Recording

Screenshot from 2022-08-17 13-09-10

After Recording

Screenshot from 2022-08-17 13-08-38

@jywarren
Copy link
Member

jywarren commented Aug 15, 2022 via email

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
@Forchapeatl
Copy link
Collaborator Author

@jywarren this PR is ready to merge. May I ?

re-commit
@Forchapeatl Forchapeatl merged commit 853857a into main Aug 19, 2022
@jywarren
Copy link
Member

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 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!

@Forchapeatl
Copy link
Collaborator Author

Forchapeatl commented Aug 20, 2022

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 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 , I didn't realize my poor actions. For this behavior I am very sorry. It wont happen again.

@jywarren
Copy link
Member

jywarren commented Aug 22, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GSoC Infragram.org full-screen UI and video upload Discussion and Planning
3 participants