2
我正在使用我的攝像頭在Flex項目上工作。一切運作良好,但只有一個人認爲我不知道該怎麼做:當我從我的「視頻聊天」窗口斷開連接時,網絡攝像頭仍然打開,我無法斷開連接。注:當我完成登錄,我調用一個函數在我Vdeo聊天窗口初始化一切:從Flex項目斷開連接時發佈攝像頭
`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
一旦你完成了你的相機,釋放所有的事件處理程序,並將'myCamera'設置爲'null'。那對你有用嗎? – dirkgently