AS3 + webcam. Dispatch event on presence - actionscript-3

I would like to know if anyone has a snippet I can adapt to achieve the following:
I've got a flash projector with some sounds embed, that needs to be lunched when the PS EYE camera I've got attached detects a motion in the room.
Any ideas are more than welcome.

Related

AS3: Recording sound as they are output/played

I understand how to record microphone input in AS3 from this doc.
Is it possible to record sound exactly as they are being output/played?
The reason is I applied some sound transform (via the global SoundMixer) to sounds that are currently playing; and I also want to record this sound data while it is being played.
I just saw this question, to clarify, I am not trying to record just all sounds on the user's computer (which is not possible). My flash app has a Youtube player in it (via their AS3 API), and it's playing some sounds. I applied transforms using SoundMixer.soundTransform, and I want to record what's being played when the user is playing it.
Thanks in advance.
Just a passing suggestion.. on my desktop it seems ABLE to record sound into Flash from a different tab playing Youtube (HTML5).. I don't know how it's doing that!!
I allow microphone here.. (none actually plugged in, and speaker out has in-ear headphones)
http://code.tutsplus.com/tutorials/create-a-useful-audio-recorder-app-in-actionscript-3--active-5836
PS: Anyone trying this must reduce Windows volume since anything above 10-20% is distorted audio into the Flash app.
And this HTML5 youtube trailer was recorded fine into the Wav file produced by Flash app above
http://www.youtube.com/watch?v=MVt32qoyhi0
So after a quick search it seems my Realtek Audio is classed as a Full-Duplex soundcard and also within its own control panel I have an option called "Multi-streaming" which is enabled/ticked. I think Full-Duplex is enough to do this though. Try options within your soundcard's own settings software. Don't know about your end-users. Some hardware will do it, some wont, there is no all-round solution outside of AIR (which makes desktop apps out of your AS3 code).

Controls for Youtube Chromeless Player In Flash

I'm tearing my hair out trying to add controls such as pause and volume to my Chromeless Youtube Player in Flash with actionscript 3, tried working with the reference that google provide but it still doesn't work. Here's what I tried, can anyone tell me where I'm going wrong?
function pauseVideo() {
if (player) {
player.pauseVideo();
}
}
pauseBtn.addEventListener(MouseEvent.CLICK,pauseVideo);
Thanks
How I understand you are trying to integrate youtube's player into your application. Take a look at this example it may help you and check with the documentation if you are loading correctly their player and it's fully loaded when you are trying to access it, first example
*I would like to help you more but I don't know how you instantiate the player

StageVideo comes on top of everything in Flex Mobile Project

I'm Building a mobile application with Flex (Air 3.3).
For Android there is sum nasty bug with stageVideo.
When I minimize the app when the stageVideo is playing or paused and open it again sometimes the stageVideo comes on top of everything. In my understanding that should be impossible because the stageVideo in a layer above the stage layer but it's happening. I don't have any clue how to fix this. I don't use any masks, I'm only attaching netStream.
Regardless of why, you may be able to fix it simply by re-asserting its index in the DisplayList with addChildAt().
The only question left is when to call the operation. I don't know about AIR, but you'd likely be looking for something akin to Event.ACTIVATE. If you can't catch an event to trigger the check, check periodically with either a Timer or Event.ENTER_FRAME

Adding a canvas-sprite object to a canvas?

I've been playing around with HTML5 and canvas and sprites and I've managed to get myself a bit stumped. I was wonderring if there was anyone out there with just a bit more experience than me who could help me 'tune' this (and also make it work).
I've got all the code up on GitHub https://github.com/AlexChesser/jsSprite and have put a live demo up over here http://chesser.ca/jsSprite
What you can see from Test 01 and 02 is that I'm able to send the Minotaur directly to the on-page canvas, I'm able to animate the Minotaur on the canvas... but when I try to create the Minotaur and add it to another canvas - I'm getting a blank screen.
(attempting to implement https://github.com/AlexChesser/jsSprite/blob/master/03-animated_minotaur_on_canvas.php)
I know it must be something small and sill that I'm doing wrong here, but I've been staring at it for hours and I can't track down the problem.
I thought I'd try posting up here to see if there's anyone who can see it 'in one go' AND to maybe let me know if there's anything I can do better.
If you're interested in getting a little further under the hood on this stuff, the lion's share of the code for this is coming from a Blog post http://www.johnegraham2.com/web-technology/html-5-canvas-tag-sprite-animation-demo/
Anyways, maybe it's one of those things that "comes to you" once you've walked away from the problem for a little bit. Fingers crossed I can either figure it out or someone out ther ecan give me that little push in the right direction.
Thanks!
:)
I just stepped through your code.
MainContext.drawImage(m.canvas, 0, 0, m.width, m.height);
is occuring before drawFrame gets called because the image isn't ready yet.
So the mainContext.drawImage is drawing a canvas that has nothing painted on it yet.
Then the Sprite's canvas is loaded and ready to go, but its too late!
For confirmation, you can call MainContext.drawImage(m.canvas, 0, 0, m.width, m.height); in the browser console and you will see the minotaur appear.
As Simon Sarris said, you are drawing the canvas too soon. What you'll need to do is either loop until the sprite is ready, or add a callback to your sprite that is called after it draws.
You already have a function attached to the image's onload event, you should be okay to do something similar for the whole sprite.

AS3 Camera selection

Has anyone build a AS3 Camera-Select-algorithm, ready to use?
With MacBooks you have the problem that the build-in webcam is not rightly choosen from the webplayer.
You have to select the USP-Cam by youself from the list
DV Video
IIDC FireWire Video
USB Video Class Video
by
camera = Camera.getCamera("2");
THNX!
I found kind of a workaround here
You cant actually set the camera programatically. The best you can do is prompt the user to set it next to a video panel to show them if the camera they've chosen actually works. example here: http://www.neave.com/webcam/
to prompt them to change cameras you use:
Security.showSettings(SecurityPanel.CAMERA)
there is no event to wait for, though you can poll your video panel's bitmap data for changes and prompt the user behind the security panel when you think they've chosen the right camera.
Having done battle with this problem, I would suggest that everyone use this library.
https://github.com/cataclysmicrewind/CameraDetection/
Flash + webcam should = easy + awesome.
Unfortunately, it is pain + suffering.