D
donexie
Unregistered / Unconfirmed
GUEST, unregistred user!
把一个user_cam(Camera对象)attachVideo到一个video_vid(视频对象)上,然后判断user_cam.currentFps是否大于0。如果摄像头被占用,那么user_cam.currentFps肯定不会大于0,而是等于0,代码如下: 谁能把它转成DELPHI
function checkCamBusy(user_cam:Camera):Void {
var chkTime:Number = 0;
var intervalID:Number;
function callback() {
trace(user_cam.currentFps);
if (user_cam.currentFps>0) {
//视频设备可用
clearInterval(intervalID);
} else
{
chkTime++;
if (chkTime>30) {
//视频设备忙
_root.video_vid.clear();
clearInterval(intervalID);
}
}
}
intervalID = setInterval(callback, 50);
}
var user_Cam = Camera.get();
_root.video_vid.attachVideo(user_Cam);
checkCamBusy(user_Cam);
function checkCamBusy(user_cam:Camera):Void {
var chkTime:Number = 0;
var intervalID:Number;
function callback() {
trace(user_cam.currentFps);
if (user_cam.currentFps>0) {
//视频设备可用
clearInterval(intervalID);
} else
{
chkTime++;
if (chkTime>30) {
//视频设备忙
_root.video_vid.clear();
clearInterval(intervalID);
}
}
}
intervalID = setInterval(callback, 50);
}
var user_Cam = Camera.get();
_root.video_vid.attachVideo(user_Cam);
checkCamBusy(user_Cam);