Giter VIP home page Giter VIP logo

Comments (3)

creativityjuice avatar creativityjuice commented on May 18, 2024

Hey,
Any idea ?

from webcamjs.

jhuckaby avatar jhuckaby commented on May 18, 2024

Hey creativityjuice,

Yeah, unfortunately I have seen this once before, and I am honestly not sure how to fix it. It seems like certain webcams with certain drivers (i.e. Flash in Safari) require a 4:3 aspect ratio in order to work properly. I've only seen this on one webcam, which was some really old Logitech cam I had, so I didn't worry about it too much. But it looks like the issue is happening to you as well.

Unfortunately, I think the only solution to this is to create a DIV at 4:3 aspect ratio for the webcam, and then "crop" the DIV by using an outer element at the aspect ratio you want, and with "overflow:hidden", then use absolute positioning to center the inner DIV inside the outer one. This should prevent the black bars from appearing.

Something like this perhaps:

<div id="outer" style="overflow:hidden; width:300px; height:400px;">
    <div id="inner" style="width:533px; height:400px; left:-116px;"></div>
</div>

Then attach the webcam to the inner DIV. Make sure the heights of the two DIVs are the same, and then adjust the widths to match the aspect ratios. Then use "left" to center the inner DIV inside the outer container, by (outer_width / 2) - (inner_width / 2).

Sorry there isn't a better solution, but this really seems like its inside the Flash webcam drivers, and nothing I have access to.

Good luck!

from webcamjs.

creativityjuice avatar creativityjuice commented on May 18, 2024

Hi jhuckaby,

I'll take a look at that these days and I'll let you know.
Thanks

from webcamjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.