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

Customizable size #8

Closed
lexcaraig opened this issue Mar 27, 2018 · 11 comments
Closed

Customizable size #8

lexcaraig opened this issue Mar 27, 2018 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@lexcaraig
Copy link

It would be great if we can customize the size of the camera. Like responsive of onDemand.

@basst314
Copy link
Owner

Do you mean by putting the webcam component in a container with predefined size, or do you mean the user should be able to resize the webcam component at runtime?

@lexcaraig
Copy link
Author

Well, i think the width and height should be responsive so anyone can just resize the container at runtime or not. :) Bec, I did some hook just to make it responsive.

Setting a fix size would be also nice.

@rickdroio
Copy link
Contributor

it is possible to set width and height like this:

<webcam [width]="320" [height]="240"></webcam>

@brayanmcz
Copy link

@rickdroio We're you able to get your camera to resize using the code you used above?
I tried it and it did not work for me.

@sam-lex
Copy link

sam-lex commented May 24, 2018

If you want to make it "responsive full screen", then this will work for you.

Not sure about custom responsive solutions, you could tweak it by doing the calculations yourself if it's not too complicated.

export class TakePictureComponent implements OnInit {
  private width: number;
  private height: number;

  @HostListener('window:resize', ['$event'])
  onResize(event?: Event) {
    const win = !!event ? (event.target as Window) : window;
    this.width = win.innerWidth;
    this.height = win.innerHeight;
  }

  constructor() {
    this.onResize();
  }
  // ...
}
<div class="wrapper" (window:resize)="onResize($event)">
  <!-- Webcam -->
  <webcam [trigger]="triggerObservable"
      [width]="width"
      [height]="height"
      (imageCapture)="onImageCapture($event)">
  </webcam>

  <!-- Controls -->
</div>
.wrapper {
  display: flex;
  background: #383838;
  height: 100vh;
  align-items: center;
  justify-content: center;
  // inexplicable/unknown extra space is rendered, causing scrollbars to show up 
  overflow: hidden;
}

@basst314
Copy link
Owner

basst314 commented Jun 7, 2018

Hi @sam-lex,

Thanks for sharing your solution. I will try to enhance the library by providing better resizeability out-of-the-box soon.
I will leave this issue open to keep you posted!

Cheers!

@basst314 basst314 self-assigned this Jun 10, 2018
@basst314 basst314 added the enhancement New feature or request label Jun 10, 2018
@basst314
Copy link
Owner

Closing this issue, current resizing capabilities should be sufficient for now

@vamsikrishna18
Copy link

how can we set the width for maximum screen

@Nitin1121
Copy link

We cant get the camera width & height to entire screen size by using the above mentioned code...We cant able to modify its dimension by using css it doesnt get applied ...can someone suggest any ways to get it fullscreen

@sayedgt
Copy link

sayedgt commented Apr 12, 2021

How to set focus distance? Any sample code will be appreciated.

@ILDEMONICO
Copy link

Is this workaround still valid? i'm trying to change component size according to an user event (i need to change from 16:9 aspect ratio to 1:1) but everytime i try to change the size, the video tag always set itself to maximum visible space with the aspect ratio setted in first instance reagrdless of any value i try to set

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

No branches or pull requests

9 participants