This commit is contained in:
sabade-omkar 2024-01-02 16:03:26 +08:00 committed by GitHub
commit 5baee8e432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,9 +112,8 @@ static const char* kVideoQueueLabel = "com.google.mediapipe.example.videoQueue";
withExtension:@"mov"]]; withExtension:@"mov"]];
self.videoSource = [[MPPPlayerInputSource alloc] initWithAVAsset:video]; self.videoSource = [[MPPPlayerInputSource alloc] initWithAVAsset:video];
[self.videoSource setDelegate:self queue:self.videoQueue]; [self.videoSource setDelegate:self queue:self.videoQueue];
dispatch_async(self.videoQueue, ^{ self.noCameraLabel.hidden = YES;
[self.videoSource start]; [self startGraphAndVideo];
});
break; break;
} }
case MediaPipeDemoSourceCamera: { case MediaPipeDemoSourceCamera: {
@ -149,6 +148,19 @@ static const char* kVideoQueueLabel = "com.google.mediapipe.example.videoQueue";
} }
} }
- (void)startGraphAndVideo {
NSError* error;
if (![self.mediapipeGraph startWithError:&error]) {
NSLog(@"Failed to start graph: %@", error);
}
else if (![self.mediapipeGraph waitUntilIdleWithError:&error]) {
NSLog(@"Failed to complete graph initial run: %@", error);
}
dispatch_async(self.videoQueue, ^{
[self.videoSource start];
});
}
- (void)startGraphAndCamera { - (void)startGraphAndCamera {
// Start running self.mediapipeGraph. // Start running self.mediapipeGraph.
NSError* error; NSError* error;