尝试修复参数不生效的问题
This commit is contained in:
parent
25a7be1eef
commit
ec0ea741a7
@ -9,32 +9,32 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class SGRecordOptions;
|
||||
|
||||
@interface SGRecordEncoder : NSObject
|
||||
@property (nonatomic, readonly) NSString *path;
|
||||
|
||||
/**
|
||||
SGRecordEncoder遍历构造器
|
||||
|
||||
@param path 媒体存发路径
|
||||
@param cy 视频分辨率的高
|
||||
@param cx 视频分辨率的宽
|
||||
@param options 视频参数
|
||||
@param ch 音频通道
|
||||
@param rate 音频的采样比率
|
||||
@return SGRecordEncoder实例
|
||||
*/
|
||||
+ (SGRecordEncoder*)encoderForPath:(NSString*) path Height:(NSInteger) cy width:(NSInteger) cx channels: (int) ch samples:(Float64) rate;
|
||||
+ (SGRecordEncoder*)encoderForPath:(NSString*) path Options:(SGRecordOptions*) options channels: (int) ch samples:(Float64) rate;
|
||||
|
||||
/**
|
||||
初始化方法
|
||||
|
||||
@param path 媒体存发路径
|
||||
@param cy 视频分辨率的高
|
||||
@param cx 视频分辨率的宽
|
||||
@param options 视频参数
|
||||
@param ch 音频通道
|
||||
@param rate 音频的采样率
|
||||
@return SGRecordEncoder实例
|
||||
*/
|
||||
- (instancetype)initPath:(NSString*)path Height:(NSInteger)cy width:(NSInteger)cx channels: (int)ch samples:(Float64)rate;
|
||||
- (instancetype)initPath:(NSString*)path Options:(SGRecordOptions*) options channels: (int)ch samples:(Float64)rate;
|
||||
|
||||
/**
|
||||
完成视频录制时调用
|
||||
|
@ -15,11 +15,11 @@
|
||||
@property (nonatomic, strong) AVAssetWriterInput *videoInput;//视频写入
|
||||
@property (nonatomic, strong) AVAssetWriterInput *audioInput;//音频写入
|
||||
@property (nonatomic, strong) NSString *path;//写入路径
|
||||
@property (nonatomic, strong) SGRecordOptions * options;
|
||||
@property (nonatomic, strong) SGRecordOptions *options;
|
||||
@end
|
||||
@implementation SGRecordEncoder
|
||||
|
||||
+ (SGRecordEncoder*)encoderForPath:(NSString*) path Options:(SGRecordOptions*) options channels: (int) ch samples:(Float64) rate{
|
||||
+ (SGRecordEncoder*)encoderForPath:(NSString*) path Options: (SGRecordOptions *) options channels: (int) ch samples:(Float64) rate{
|
||||
SGRecordEncoder* enc = [SGRecordEncoder alloc];
|
||||
enc.options = options;
|
||||
return [enc initPath:path channels:ch samples:rate];
|
||||
|
@ -561,7 +561,7 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
|
||||
[self setAudioFormat:fmt];
|
||||
NSString *videoName = [self getUploadFile_type:@"video" fileType:@"mp4"];
|
||||
self.videoPath = [[self getVideoCachePath] stringByAppendingPathComponent:videoName];
|
||||
self.recordEncoder = [SGRecordEncoder encoderForPath:self.videoPath Height:_cy width:_cx channels:_channels samples:_samplerate];
|
||||
self.recordEncoder = [SGRecordEncoder encoderForPath:self.videoPath Options: self.options channels:_channels samples:_samplerate];
|
||||
}
|
||||
//判断是否中断录制过
|
||||
if (self.discont) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Cordova/CDVCommandDelegate.h>
|
||||
|
||||
@protocol CDVCommandDelegate;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
#import <Cordova/CDVInvokedUrlCommand.h>
|
||||
#import <Cordova/CDVCommandDelegate.h>
|
||||
#import "SGRecordOptions.h"
|
||||
|
||||
|
||||
@ -20,6 +19,7 @@
|
||||
options.bitRate = [command argumentAtIndex:3 withDefault: @(options.height * options.width * 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);
|
||||
return options;
|
||||
}
|
||||
@end
|
||||
|
@ -15,7 +15,6 @@
|
||||
#import "SGRecordProgressView.h"
|
||||
#import "UIButton+Convenience.h"
|
||||
#import "SGRecordOptions.h"
|
||||
#import "SGRecordOptions.h"
|
||||
#import "SGMotionManager.h"
|
||||
|
||||
#define TIMER_INTERVAL 0.5 //定时器时间间隔
|
||||
|
@ -1,7 +1,16 @@
|
||||
var exec = require('cordova/exec');
|
||||
var argscheck = require('cordova/argscheck');
|
||||
|
||||
module.exports = {
|
||||
capture(option, success, error) {
|
||||
exec(success, error, 'CapturePlugin', 'capture', [option.width,option.height,option.frameRate,option.bitRate,option.limit,option.duration]);
|
||||
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 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