Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcmellado/flashcam
Webcam video capture, from ActionScript to JavaScript
https://github.com/jcmellado/flashcam
Last synced: about 2 months ago
JSON representation
Webcam video capture, from ActionScript to JavaScript
- Host: GitHub
- URL: https://github.com/jcmellado/flashcam
- Owner: jcmellado
- License: mit
- Archived: true
- Created: 2015-03-27T18:48:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-27T18:53:31.000Z (almost 10 years ago)
- Last Synced: 2024-06-23T19:35:27.448Z (7 months ago)
- Language: ActionScript
- Homepage:
- Size: 141 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-actionscript-sorted - flashcam - Webcam video capture, from ActionScript to JavaScript (File Formats / JavaScript)
README
Capture video on Flash so you can use it from JavaScript using ExternalInterface.
### Demo ###
Try the [live demo](http://www.inmensia.com/files/flashcam/demo/demo.html)!
### How to use it? ###
The library calls the `cameraUnmuted` JavaScript function when the user "unmutes" webcam on Flash:
```
var camera, canvas, context, imageData, pixels;function cameraUnmuted(){
camera = document.getElementById("flashcam");
canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
}
```Then the `snapshot` function of the `camera` object can be called anytime to get the image data:
```
function snapshot(){
var image = imageData.data, i = 0, j = 0, pixel = 0, len;pixels = camera.snapshot().split(",");
len = pixels.length - 1;
while(len --){
pixel += parseInt( pixels[j ++], 36);image[i ++] = pixel >> 16;
image[i ++] = (pixel >> 8) & 0xff;
image[i ++] = pixel & 0xff;
image[i ++] = 255;
}context.putImageData(imageData, 0, 0);
}
```### Security Issue ###
You probably need to visit the Flash settings on the Global Security Panel to run the demo on your local hard drive.
Search "flash global security settings" on Google to get more information.