Release webcam when disconnected from a Flex project

OZdelilah

New Member
i'm working on a flex project using my webcam. everything works very well but there is just one think i don't know how to do it: when i disconnect from my "Video-chat" window, the webcam still on and i can't disconnect it. Notes: when i finish Logging in, i call a function to init everything in my Vdeo-chat window:\[code\]`public function initVars() : void { urlBox_publish.text = "rtmp:/live"; streamBox_publish.text = "cameraFeed"; urlBox_playbk.text = "rtmp:/live"; streamBox_playbk.text = "cameraFeed"; initCamera(); return; }// end function` public function initCamera() : void { trace("In InitCamera"); myCamera = Camera.getCamera(); if (!myCamera) { trace("Error, No camera is installed"); errorBox_publish.text = "Error, No camera is installed"; errorBox_publish.visible = true; bPlayStop_publish.visible = false; publishBtn.visible = false; cameraDetectTimer.addEventListener(TimerEvent.TIMER, initCamera); cameraDetectTimer.start(); return; } myCamera.setMode(314, 214, 12); localVideo.attachCamera(myCamera); errorBox_publish.visible = false; bPlayStop_publish.visible = true; publishBtn.visible = true; return; }// end function\[/code\]
 
Back
Top