iphone接收发来的视频正常,ipad接收视屏时,画面旋转了90°,而且录制本地视频也旋转了90°。在ipad端做了旋转处理,才正常了。代码如下: 远程视频载体 UIImageView *aImageView = [[UIImageView alloc] init]; aImageView.frame = CGRectMake(0, CHATTITLEVIEWHEIGHT, 1024,mainScreenSize.width-CHATTITLEVIEWHEIGHT-69); aImageView.transform = CGAffineTransformMakeRotation(M_PI/2); aImageView.center = CGPointMake(aImageView.frame.size.width/2, aImageView.frame.size.height/2); aImageView.layer.anchorPoint = CGPointMake(0.5, 0.5); aImageView.layer.borderColor = [UIColor whiteColor].CGColor; self.remoteVideoSurface = aImageView; [self.view addSubview:aImageView]; [self.view sendSubviewToBack:aImageView]; [aImageView release];
本地视频载体:
self.localVideoSurface = [AVCaptureVideoPreviewLayer layerWithSession: (AVCaptureSession*)session]; self.localVideoSurface.frame = CGRectMake(0, 0, self.frame.size.height, self.frame.size.width); self.localVideoSurface.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); [self.localVideoSurface setTransform:CATransform3DMakeRotation(M_PI/2, 0, 0, 1)]; self.localVideoSurface.anchorPoint = CGPointMake(0.5, 0.5); self.localVideoSurface.videoGravity = AVLayerVideoGravityResizeAspectFill; [self.layer addSublayer:self.localVideoSurface];
但是这样设置之后,又出现一个新问题:当接收android设备发来的视频时,画面又旋转了90°。 请问该如何处理?
|