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

Process Video Locally, Accept Multiple video Resolutions and Canvas Recording #439

Closed
wants to merge 7 commits into from

Conversation

Forchapeatl
Copy link
Collaborator

@Forchapeatl Forchapeatl commented Jul 28, 2022

Fixes #418
Combines Process Video Locally , Accept Multiple video Resolutions and Canvas Recording

Related pending milestones

  • canvas assumes wrong div size upon fullscreen exit.
  • image files not loading when after Webrtc is intitialized
  • Relate Canvas resolution to device GPU.
  • Optimize local video files with size greater than 10MB.

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

@gitpod-io
Copy link

gitpod-io bot commented Jul 28, 2022

@Forchapeatl Forchapeatl added the gsoc Issues associated with Google Summer of Code(GSOC) label Jul 28, 2022
@Forchapeatl Forchapeatl changed the title Create index3.html Process Video Locally, Accept Multiple video Resolutions and Canvas Recording Jul 28, 2022
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.

Looking great, just some small changes!

src/io/camera.js Outdated
if (webRtcOptions.context === "webrtc") {
video = webRtcOptions.videoEl;
video = document.getElementById("webCamVideoEl");
Copy link
Member

Choose a reason for hiding this comment

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

Hi Forcha, this is looking really good. I wanted to note that these lines where we access an options parameter instead of directly using a string are intended to make it easy to point the entire system at a different HTML setup without having to change multiple spots within the code. So if it's possible to preserve these in all the changes you made that would be great. I'm happy to help explain how this gets set and how it works if that's helpful!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you @jywarren. I have made the requested changes on line 91

+  video = webRtcOptions.videoEl;
-  video = document.getElementById("webCamVideoEl");

reader.readAsDataURL(this.files[0]);
$('#preset-modal').modal('show');
reader.readAsDataURL(this.files[0]);
}else{
Copy link
Member

Choose a reason for hiding this comment

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

There's a little bit of formatting cleanup we could do here maybe?

Copy link
Collaborator Author

@Forchapeatl Forchapeatl Jul 28, 2022

Choose a reason for hiding this comment

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

Yes alot has to be done here. Thank you, I keep on forgetting

  1. Show image if is selected after Webrtc has been initialized.
  2. Hide Video controls when image is selected.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Member

Choose a reason for hiding this comment

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

Moved this thread to #441!

webRtcOptions.videoEl.setAttribute('autoplay', 'autoplay');
webRtcOptions.videoEl.setAttribute('playsinline', 'playsinline');
webRtcOptions.videoEl.setAttribute('id', 'webCamVideoEl');
var webCamVideoEl = document.getElementById('webCamVideoEl')
Copy link
Member

Choose a reason for hiding this comment

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

Here also we could set this from the constructor options! See my next comment below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please help me with the follow up

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please help me with the follow up comment.

Copy link
Member

@jywarren jywarren Jul 31, 2022

Choose a reason for hiding this comment

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

Suggested change
var webCamVideoEl = document.getElementById('webCamVideoEl')
options.webcamVideoSelector = options.webcamVideoSelector || 'webcamVideoEl';
options.webcamVideoEl = document.getElementById(options.webcamVideoSelector);
webRtcOptions.videoEl.setAttribute('id', options.webcamVideoSelector);

How about this? So we can set it explicitly in the constructor, but it defaults to webcamVideoEl?

Also, in another PR, we add to the README to show exactly what can be set in the constructor. We can add a section to https://github.com/publiclab/infragram/#contributing -- following the general format of this example: https://github.com/publiclab/inline-markdown-editor/#usage

Does that make sense? What do you think?

Also watch out, the substitution feature of GitHub can only do one line so here I also missed modifying the line above, webRtcOptions.videoEl.setAttribute('id', 'webCamVideoEl');.

module.exports = function Interface(options) {
module.exports = function Interface(options) {

var isVideo = false, isCamera=false; var isOnCam;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var isVideo = false, isCamera=false; var isOnCam;
var isVideo = false,
isCamera = false,
isOnCam;

img = new Image();
img.onload = function onImageLoad() {
options.processor.updateImage(this);
if ((this.files[0].type == 'image/jpeg')||(this.files[0].type == 'image/png')) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if ((this.files[0].type == 'image/jpeg')||(this.files[0].type == 'image/png')) {
if ((this.files[0].type == 'image/jpeg') || (this.files[0].type == 'image/png')) {

@Forchapeatl
Copy link
Collaborator Author

I will address these issues separately.
Process video locally Closed in relation to #445

@Forchapeatl Forchapeatl closed this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc Issues associated with Google Summer of Code(GSOC)
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
2 participants