Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Video device is still connecting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Video device is still connecting?



Hi everybody,

I have been trying all the time to set a NSTimer to check, wether the video device is connected or not before the capture and during the capture. But the timer leaded the OS to crash. I don't know why. Here is the code i wrote,  can anybody tell me which problem i have?
If I don't use NSTimer, everything works. As soon as i begin the NSTimer, it works for one or two seconds, then the OS crashes.


NSTimer * _myTimer;
QTCaptureDevice *videoDevice;
BOOL connected;
BOOL occupied;

- (id) init {


[super init];
connected = NO;
occupied = YES;


videoDevice =[[QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] retain];
_myTimer = [NSTimer scheduledTimerWithTimeInterval: 2 target:self selector:@selector(testDevice:) userInfo:nil repeats:YES];
[_myTimer fire];

return self;
}

- (void)testDevice:(NSTimer *)theTimer{


connected = [videoDevice isConnected];


if(connected) occupied = [videoDevice isInUseByAnotherApplication]; 


if(!connected) {
...
}else{
if(occupied) {
...


}
}


if((connected)&&(!occupied)){
...
}


}



Thanks a lot

Mei
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.