我已经为iPhone创建了一个应用程序,对于4S我想通过AirPlay支持应用程序的屏幕镜像.
使用System AirPlay选择器并启用镜像,它将镜像应用程序而不会出现任何问题.
我想在应用程序中提供此选择器并使用以下基本代码:
MPVolumeView *volumeView = [ [MPVolumeView alloc] init] ;
[volumeView setShowsVolumeSlider:NO];
[volumeView sizeToFit];
[self.view addSubview:volumeView];
Run Code Online (Sandbox Code Playgroud)
这提供了一个AirPlay选择器,我可以选择Apple TV.但它并不反映AirPlay上的内容.当我进入系统选择器时,它显示已选择AppleTV,并且为了启用镜像,我必须在此处使用开关.
所以问题是,当用户使用应用程序选择器选择AirPlay时,如何在应用程序中启用镜像?
谢谢
我正在尝试为我的应用程序限制我的视频捕获帧速率,因为我发现它正在影响VoiceOver性能.
目前,它从摄像机捕获帧,然后尽快使用OpenGL例程处理帧.我想在捕获过程中设置一个特定的帧速率.
我希望能够通过使用videoMinFrameDuration或minFrameDuration来实现这一点,但这似乎对性能没有任何影响.有任何想法吗?
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices)
{
if ([device position] == AVCaptureDevicePositionBack)
{
backFacingCamera = device;
// SET SOME OTHER PROPERTIES
}
}
// Create the capture session
captureSession = [[AVCaptureSession alloc] init];
// Add the video input
NSError *error = nil;
videoInput = [[[AVCaptureDeviceInput alloc] initWithDevice:backFacingCamera error:&error] autorelease];
// Add the video frame output
videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setAlwaysDiscardsLateVideoFrames:YES];
[videoOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
[videoOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
// Start capturing …Run Code Online (Sandbox Code Playgroud)