Giter Site home page Giter Site logo

react-camera-sample's People

Contributors

k-ibaraki avatar

Watchers

 avatar

react-camera-sample's Issues

Videoエレメントが画面上に表示されてないと、Canvas上に動画が再生されない

  • Webカメラの動画をReact-webcamで表示している。
    • 内部的にはおそらく<video>を使っている。
  • その情報をCanvasに渡して、Canvas上でもWebカメラの動画を表示できるようにしている。
  • しかし、元のWebカメラ画像(<video>)がブラウザの画面上に存在していないとCanvas上の動画も再生されなくなる。
    • 特にiPadのSafariは他のブラウザより厳しい。
  • つまりCanvas上でWebカメラの動画を表示するには、元のカメラ画像の表示も必要。2重に表示される。

とりあえず、元のカメラ画像の透過度100%、画面右上固定、z-indexをマイナスにして見た目上は消せるようにしたが、本質的には画面上に存在していて、無駄でスマートではない。

forceUpdateで強制レンダリングさせている箇所がある。

2箇所ある。なんか微妙。

  • videoの再生が開始された時にCanvasを再生成する為に使用(初回ロード時にはまだvideoがなくてCanvas側でvideoを読み取れない。再生開始のタイミングなら確実にvideoを読めるなのでこのタイミングでCanvasを再生成したい)
    • なにかいい対応案あれば、、、
  • videoのサイズが変更された時に、Canvasのサイズも変更する為に使用( iPadを回転させた時にカメラの向きが代わり縦横比も変わるのに対処するために実装 )
    • Canvasのサイズの変更のために実施しているので、Canvasのサイズをstateに持たせて更新すればいいはずだが面倒くさくてやっていない

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.