处理参数异常
This commit is contained in:
parent
ec0ea741a7
commit
02fa78b9e3
@ -51,14 +51,14 @@
|
||||
//初始化视频输入
|
||||
- (void)initVideoInputHeight {
|
||||
// 码率和帧率设置
|
||||
NSDictionary *compressionProperties = @{ AVVideoAverageBitRateKey:@(self.options.bitRate),
|
||||
AVVideoExpectedSourceFrameRateKey:@(self.options.frameRate),
|
||||
AVVideoMaxKeyFrameIntervalKey:@(self.options.frameRate),
|
||||
NSDictionary *compressionProperties = @{ AVVideoAverageBitRateKey:@(self.options.bitRate.intValue),
|
||||
AVVideoExpectedSourceFrameRateKey:@(self.options.frameRate.intValue),
|
||||
AVVideoMaxKeyFrameIntervalKey:@(self.options.frameRate.intValue),
|
||||
AVVideoProfileLevelKey:AVVideoProfileLevelH264BaselineAutoLevel };
|
||||
NSDictionary* settings = @{AVVideoCodecKey:AVVideoCodecH264,
|
||||
AVVideoScalingModeKey:AVVideoScalingModeResizeAspectFill,
|
||||
AVVideoWidthKey:@(self.options.width),
|
||||
AVVideoHeightKey:@(self.options.height),
|
||||
AVVideoWidthKey:@(self.options.width.intValue),
|
||||
AVVideoHeightKey:@(self.options.height.intValue),
|
||||
AVVideoCompressionPropertiesKey:compressionProperties };
|
||||
|
||||
//初始化视频写入类
|
||||
|
@ -47,7 +47,7 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.maxRecordTime = self.options.duration;
|
||||
self.maxRecordTime = self.options.duration.intValue;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
|
||||
@property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate;
|
||||
@property (strong) NSString* callbackId;
|
||||
@property (assign) NSInteger frameRate;
|
||||
@property (assign) NSInteger bitRate;
|
||||
@property (assign) NSInteger width;
|
||||
@property (assign) NSInteger height;
|
||||
@property (assign) NSInteger limit;// 录制视频最短时间
|
||||
@property (assign) NSInteger duration;
|
||||
@property (strong) NSNumber * frameRate;
|
||||
@property (strong) NSNumber * bitRate;
|
||||
@property (strong) NSNumber * width;
|
||||
@property (strong) NSNumber * height;
|
||||
@property (strong) NSNumber * limit;// 录制视频最短时间
|
||||
@property (strong) NSNumber * duration;
|
||||
|
||||
+ (instancetype) createFromArguments:(CDVInvokedUrlCommand*)command;
|
||||
@end
|
||||
|
@ -16,10 +16,12 @@
|
||||
options.width = [command argumentAtIndex:0 withDefault:@(360)];
|
||||
options.height = [command argumentAtIndex:1 withDefault:@(640)];
|
||||
options.frameRate = [command argumentAtIndex:2 withDefault:@(30)];
|
||||
options.bitRate = [command argumentAtIndex:3 withDefault: @(options.height * options.width * 6)];
|
||||
options.bitRate = [command argumentAtIndex:3 withDefault: @(options.height.intValue * options.width.intValue * 6)];
|
||||
options.limit = [command argumentAtIndex:4 withDefault:@(3)];
|
||||
options.duration = [command argumentAtIndex:5 withDefault:@(10)];
|
||||
NSLog(@"width:%d - height:%d - frameRate:%d - bitRate:%d limit:%d dutation:%d",options.width,options.height,options.frameRate,options.bitRate,options.limit,options.duration);
|
||||
NSLog(@"width:%d - height:%d - frameRate:%d - bitRate:%d limit:%d dutation:%d",
|
||||
options.width.intValue,options.height.intValue,options.frameRate.intValue,
|
||||
options.bitRate.intValue,options.limit.intValue,options.duration.intValue);
|
||||
return options;
|
||||
}
|
||||
@end
|
||||
|
@ -363,7 +363,7 @@
|
||||
NSLog(@"开始录制视频");
|
||||
[self.recordButton setScale];
|
||||
[self startRecord];
|
||||
} else if (_timeInterval >= RECORD_TIME + self.options.limit) {
|
||||
} else if (_timeInterval >= RECORD_TIME + self.options.limit.intValue) {
|
||||
[self removeTimer];
|
||||
}
|
||||
}
|
||||
@ -378,7 +378,7 @@
|
||||
- (void)toucheUpInsideOrOutSide:(UIButton *)button{
|
||||
NSLog(@"抬起按钮:__timeInterval==:%f",_timeInterval);
|
||||
[self removeTimer];
|
||||
if (_timeInterval >= RECORD_TIME && _timeInterval < RECORD_TIME + self.options.limit) {
|
||||
if (_timeInterval >= RECORD_TIME && _timeInterval < RECORD_TIME + self.options.limit.intValue) {
|
||||
// 录制时间太短
|
||||
NSLog(@"录制时间太短");
|
||||
[self stopRecord:NO];
|
||||
|
@ -5,10 +5,10 @@ module.exports = {
|
||||
capture(option, success, error) {
|
||||
var getValue = argscheck.getValue;
|
||||
|
||||
var width = getValue(option.width, 360);
|
||||
var height = getValue(option.height, 640);
|
||||
var frameRate = getValue(option.frameRate, 30);
|
||||
var bitRate = getValue(option.bitRate, width * height * 6);
|
||||
var width = getValue(option.width, null);
|
||||
var height = getValue(option.height, null);
|
||||
var frameRate = getValue(option.frameRate, null);
|
||||
var bitRate = getValue(option.bitRate, null);
|
||||
var limit = getValue(option.limit, 3);
|
||||
var duration = getValue(option.duration, 10);
|
||||
exec(success, error, 'CapturePlugin', 'capture', [width,height,frameRate,bitRate,limit,duration]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user