Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unable to turn off my webcam using AS3

Guest
Oct 31, 2013 Oct 31, 2013

To turn off my webcam (light) I'm using

onScrenVideo.attachCamera(null)

where onScreenVideo is a Video object.

However, this just doesn't seem to work. Even after this line executes, the webcam light remains ON.

I have scoured the Internet for a solution to this problem and everyone seems to be unanimous that this is the only way to turn the webcam off, however, this just doesn't seem to be working for me.

Can anyone help?

Thanks

TOPICS
ActionScript
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 31, 2013 Oct 31, 2013

If you have a netstream object, call attachCamera(null) on that.

Otherwise, directly on a video container on stage should work. As a test, I just added a video object to the library, dragged it on stage, gave it an instance name of vid, and then added this script:

 

var cam:Camera = Camera.getCamera(); 

vid.attachCamera(cam);

aButton.addEventListener(MouseEvent.CLICK, detach);

function detach(e:MouseEvent):void

{

          vid.attachCamera(null);

}

And it works fine - light on cam goes off.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 31, 2013 Oct 31, 2013
LATEST

I have done something similar.  

testCurrCam = Camera.getCamera();

onScreenVideo = new Video(240, 180);

onScreenVideo.smoothing = true;

onScreenVideo.x = 0;

onScreenVideo.y = 0;

addChild(onScreenVideo);

testCurrCam.setQuality(0, 70);

testCurrCam.setMode(640, 480, 10);

onScreenVideo.attachCamera(testCurrCam);

And to stop the cam the following function is called. 

private function stopCam(): void {  

     if (contains(onScreenVideo)) {       

          onScreenVideo.attachCamera(null);

          this.removeChild(onScreenVideo);

          onScreenVideo = null;

          testCurrCam = null;

       }   else

             return;

}

The variable declarations are done elsewhere. This doesn't seem to work. The video is displayed all right, but when a button is clicked, and stopCam is called, the light doesn't go off. The problem exists on Windows, Mac and Linux.  The functions are called from JS using ExternalInterface.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines