为什么使用Ionic cordovaCapture(Apache Cordova媒体捕获插件)在iOS上录制低分辨率视频(480x360)? [英] Why low resolution video (480x360) recording on iOS with Ionic cordovaCapture (Apache Cordova media capture plugin)?

查看:312
本文介绍了为什么使用Ionic cordovaCapture(Apache Cordova媒体捕获插件)在iOS上录制低分辨率视频(480x360)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个离子项目中,我正在使用 cordova捕获插件录制视频在 Apache媒体捕获插件上.

On an Ionic project I am recording videos with cordova capture plugin which in fact is based on Apache media-capture plugin.

Android用户可以选择视频尺寸,但是在iOS上没有相应的按钮.我正在使用iPhone 5进行测试,该iPhone 5的录制分辨率为1920x1080,但我的Ionic应用视频为480x360,请注意宽高比为4:3而不是16:9. 我想要至少720p的视频尺寸.

Android users can choose video dimensions, but on iOS there are no buttons for that. I am testing with an iPhone 5 which records in 1920x1080, but with my Ionic app videos are 480x360, notice also aspect ratio is 4:3 no 16:9. I want at least a 720p video dimensions.

我阅读了插件文档,只有三个选项;持续时间和限制.这是否意味着无法设置视频的尺寸?

I read plugin documentation and there are only three options; duration and limit. Does it means is not possible to set the dimensions of the video?

var options = { 
    limit: 1, 
    duration: 15,
    quality: 1 // Only for Android, Video quality parameter, 0 means low quality, suitable for MMS messages, and value 1 means high quality
}; 

$cordovaCapture.captureVideo(options)
    .then(function(videoData) {});

此外,我还看到了配置数据部分.我不知道该不该使用.我尝试将widthheight添加到options对象,但结果与以前相同.

Besides I saw Configuration Data part. I don't know were should I use that. I tried adding width and height to options object but I have same result as before.

var options = { 
    limit: 1, 
    duration: 15,
    type: "video/quicktime",
    height: 720,
    width: 1280,
    quality: 1
};

它说不受任何平台支持,这很奇怪吗? :-)

It said is not supported by any platform, is not this weird? :-)

不受任何平台支持.所有配置数据数组都是 空的.

Not supported by any platform. All configuration data arrays are empty.

任何想法我该怎么办?

推荐答案

我之前已解决此问题,我确实在编辑captureVideo插件.

I fixed this issue time ago, I did editing captureVideo plugin.

无法为所有设备设置分辨率.如果选择高,则在某些设备中表示1080p,在旧设备中表示720p.

Is was not possible to set the resolution for all devices. If you choose high it means 1080p in some devices and eg 720p in old ones.

在JS上,我向插件选项添加了新属性'ios_quality'

On the JS I added a new property 'ios_quality' to plugin options:

var options = { 
    limit: 1, 
    duration: 20,
    ios_quality: 'high'
};

在CDVCapture.m上,我在if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {}

On CDVCapture.m I added quality option inside if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {}

// iOS 4.0
if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {
    pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;

    NSNumber* quality = [options objectForKey:@"ios_quality"];

    if ([quality isEqual:@("compression_none_640x480")]){ //Compression none
        pickerController.videoQuality = UIImagePickerControllerQualityType640x480;
    }
    else if ([quality isEqual:@("compression_none_960x540")]){ //Compression none
        pickerController.videoQuality = UIImagePickerControllerQualityTypeIFrame960x540;
    }
    else if ([quality isEqual:@("compression_none_1280x720")]){ //Compression none
        pickerController.videoQuality = UIImagePickerControllerQualityTypeIFrame1280x720;
    }
    else if ([quality isEqual:@("high")]){ //Compression low
        pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
    }
    else if ([quality isEqual:@("medium")]){ //Compression medium
        pickerController.videoQuality = UIImagePickerControllerQualityTypeMedium;
    }
    else if ([quality isEqual:@("low")]){ //strongest compression, resolution 192x144
        pickerController.videoQuality = UIImagePickerControllerQualityTypeLow;
    }

    // pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
    // pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
    // pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
}

这篇关于为什么使用Ionic cordovaCapture(Apache Cordova媒体捕获插件)在iOS上录制低分辨率视频(480x360)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆