by Kevin Schroeder | 2:27 pm

I’m going to be doing a video critique of some source code later on today and the people being critiqued wanted to have my mug showing so they could see the looks of incredulity (I am kidding, of course).  So I did some looking around to find something that would keep the webcam software on top of the other windows.  Turns out there’s not much there or there was some kind pay mechanism and I really didn’t want to pay money to see myself in a webcam window that stayed above the other windows.

So, me being me, I decided to use our Flash Builder for PHP IDE and write what I needed.  It’s nice and simple.  Here’s the code.

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
 xmlns:s="library://ns.adobe.com/flex/spark" 
 xmlns:mx="library://ns.adobe.com/flex/mx"
 alwaysInFront="true"
 creationComplete="initCamera()">
 <fx:Script>
 <![CDATA[
 import mx.collections.ArrayCollection;
 import mx.rpc.events.ResultEvent;
 
 protected var video : Video;
 protected var resolutions : Array = [{
 height: 480, width: 640
 },{
 height: 600, width: 800
 },{
 height: 768, width: 1024
 },{
 height: 720, width: 1280
 }
 ];
 
 protected function initCamera() : void {
 if (video) {
 videoDisplay.removeChild(video);
 }
 var camWidth : int = resolutions[cameraRes.value]["width"]; 
 var camHeight : int = resolutions[cameraRes.value]["height"]; 
 video = new Video(camWidth, camHeight);
 var camera : Camera = Camera.getCamera();
 camera.setMode(camWidth, camHeight, 30, true);
 video.attachCamera(camera);
 videoDisplay.addChild(video);
 width = camera.width;
 height = camera.height;
 }
 ]]>
 </fx:Script>
 <s:VideoDisplay x="0" y="0" width="100%" height="100%" id="videoDisplay" />
 <s:HSlider bottom="10" width="17%" change="initCamera()" horizontalCenter="-1" maximum="4"
 minimum="0" value="0" id="cameraRes"/>
</s:WindowedApplication>

Here’s the AIR file.  If you have AIR installed you can easily run it.  Here it is with a Windows installer.

Comments

ben

i love this, so simple, so right , so much easier than all the other nonsense. Thanks 🙂

Aug 23.2015 | 04:24 pm

Bruce

I love it… Is there a way to do this with an IP cam?

Oct 17.2015 | 05:32 pm

    Kevin Schroeder

    I’m sure there is, but I couldn’t help you. I haven’t done this in a while.

    Oct 20.2015 | 11:26 am

Dr.Nagabhushana Rao

It is a great software. Can you provide an option to resize and reposition the window.- say about 2 inches in the left upper corner. This would be very useful to project the speaker’s live video during a live powerpoint presentaion.

Feb 27.2016 | 11:15 pm

Sean

No longer available?

Jan 25.2017 | 11:08 am

    Kevin Schroeder

    I guess it must have been purged some time ago. This post is 5 years old.

    Jan 25.2017 | 11:21 am

      Kevin Schroeder

      5 years and two jobs ago 🙂

      Jan 25.2017 | 11:21 am

        Sean

        It looks like it was there as of last February, so I was hoping.

        I have my webcam pointed at the door (tall cubical, blind view of the entrance) and was looking for a small windowed app that shows what the cam sees and even better if it could stay on top.

        Jan 25.2017 | 01:32 pm

          Kevin Schroeder

          Yeah, I did some housecleaning as I moved all my stuff over to Docker and thought to myself “nobody’s going to want this.” I’ll check around and see if I still have it somewhere.

          Jan 25.2017 | 01:58 pm

          Kevin Schroeder

          Found it. Try downloading them now. Note, I make no guarantees of their working-ness. 😉

          Jan 25.2017 | 02:02 pm

Leave a Reply

Your email address will not be published. Required fields are marked *