1.用avplayer播放时,需要设置为全局属性,如果是临时变量,会播放不了音频。
2.如果后台时根据你的请求方式来判断某些事项的话,如果移动端是用post请求,但是后台后去到的是get请求,有可能是请求的地址出问题了,因为我试过是http://.......的话,我用post请求,到后台变成了get请求,但是我用https://......的话后台获取的就是post请求。这个有可能是不会把http强转。
3.使用avcapturesession的时候,调用摄像头录制视频的时候,数据源会旋转了90度,这时需要设置预览层_previewLayer.connection.videoOrientation= [self videoOrientationFromCurrentDeviceOrientation];
- (AVCaptureVideoOrientation) videoOrientationFromCurrentDeviceOrientation {
UIInterfaceOrientation orientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
switch (orientation) {
case UIInterfaceOrientationPortrait: {
return AVCaptureVideoOrientationPortrait;
}
case UIInterfaceOrientationLandscapeLeft: {
return AVCaptureVideoOrientationLandscapeLeft;
}
case UIInterfaceOrientationLandscapeRight: {
return AVCaptureVideoOrientationLandscapeRight;
}
case UIInterfaceOrientationPortraitUpsideDown: {
return AVCaptureVideoOrientationPortraitUpsideDown;
}
case UIInterfaceOrientationUnknown:
return AVCaptureVideoOrientationLandscapeRight;
}
return AVCaptureVideoOrientationLandscapeRight;
}
这个需要用statusbar的方向,不能用设备的方向,因为设备有六种方向,除了protrait和landscape外还有faceUp和faceDown这两种情况,是处理不了的。
重点注意:如果一个app 比如在ipad里只设置了横屏显示,但是如果要调用系统的相簿,这时会报错,具体错忘记了
需要再appdelegate里去设置
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (_bAlbumListViewStatus)
//全局变量,定义是否打开相册
return UIInterfaceOrientationMaskAll;
else
return UIInterfaceOrientationMaskLandscape;
}
还要写一个分类