Git Product home page Git Product logo

devnawjesh / webcam Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 221 KB

Accessing your webcam via your browser used to involve a...pardon the profanity, a plugin. That's right. In order to connect to a webcam and gain access to its video stream, you had to rely on something primarily created in Flash or Silverlight. While that approach certainly worked for browsers that supported plug-ins, it didn't help for the increasing number of browsers that aim to be plugin-free. This inability to natively access the webcam without relying on 3rd party components was certainly a gap in the HTML development story. At least, that was the case until pretty recently.

webcam-capture webcam getusermedia screen-capture webcam-streaming video-streaming webcamjs screenshot web-application

webcam's Introduction

webcam

Accessing your webcam via your browser used to involve a...pardon the profanity, a plugin. That's right. In order to connect to a webcam and gain access to its video stream, you had to rely on something primarily created in Flash or Silverlight. While that approach certainly worked for browsers that supported plug-ins, it didn't help for the increasing number of browsers that aim to be plugin-free. This inability to natively access the webcam without relying on 3rd party components was certainly a gap in the HTML development story. At least, that was the case until pretty recently.

How to Use Webcam In PHP: Here we will use the JPEG Camera script for the webcam functions to take the snap and save it. index.php

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="jpeg_camera/jpeg_camera_with_dependencies.min.js" type="text/javascript"></script>

Below the form we will put our webcam window to show the webcam screen capture.


Take Snapshots
Now it's time to process the image snap. Add this code to index.php :

<script> var options = { shutter_ogg_url: "jpeg_camera/shutter.ogg", shutter_mp3_url: "jpeg_camera/shutter.mp3", swf_url: "jpeg_camera/jpeg_camera.swf", }; var camera = new JpegCamera("#camera", options); $('#take_snapshots').click(function(){ var snapshot = camera.capture(); snapshot.show(); console.log(snapshot); snapshot.upload({api_url: "action.php"}).done(function(response) { $('#imagelist').prepend("

"+response+""); }).fail(function(response) { alert("Upload failed with status " + response); }); }) function done(){ $('#snapshots').html("uploaded"); } </script>

Now when we receive the success message, we will show it in a table.

ImageImage Name

You can also use getUserMedia in index2.php and index3.php

webcam's People

Contributors

devnawjesh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.