gpt4 book ai didi

cordova - 为什么使用 Ionic cordovaCapture(Apache Cordova 媒体捕获插件)在 iOS 上录制低分辨率视频 (480x360)?

转载 作者:行者123 更新时间:2023-12-04 15:33:02 25 4
gpt4 key购买 nike

在 Ionic 项目中,我正在使用 cordova capture plugin 录制视频这实际上是基于 Apache media-capture plugin .

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

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

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) {});

另外我看到了 Configuration Data部分。我不知道我是否应该使用它。我尝试添加 widthheight到选项对象,但我的结果与以前相同。
var options = { 
limit: 1,
duration: 15,
type: "video/quicktime",
height: 720,
width: 1280,
quality: 1
};

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

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



知道我能做什么吗?

最佳答案

我之前解决了这个问题,我编辑了 captureVideo 插件。

无法为所有设备设置分辨率。如果您选择高,则意味着在某些设备中为 1080p,例如在旧设备中为 720p。

在 JS 上,我向插件选项添加了一个新属性“ios_quality”:

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

在 CDVCapture.m 上,我在 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;
}

关于cordova - 为什么使用 Ionic cordovaCapture(Apache Cordova 媒体捕获插件)在 iOS 上录制低分辨率视频 (480x360)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31966709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com