ios的限制时间的短视屏无法录制,h5+的stopVideoCapture在安卓和ios都不支持暂不支持调用此API停止摄像,需要手动操作停止,只能用native.js进行原生调用但是implements实现代理方法的时候,监听只能返回一个参数;需要的视频路径在第二个参数里面,取不到.
var cameraVideo = plus.ios.newObject("UIImagePickerController");
plus.ios.importClass('NSDictionary');
var delegate = plus.ios.implements('UIImagePickerControllerDelegate',
{'imagePickerController:didFinishPickingMediaWithInfo:':function(picker,info){
console.log(arguments.length);//只有一个参数
console.log(info);//为空
plus.ios.invoke(arguments[0],'dismissViewControllerAnimated:completion:','YES',null);
}});
cameraVideo.plusSetAttribute('delegate',delegate);
cameraVideo.plusSetAttribute('sourceType',1);
var iosArray = plus.ios.newObject('NSMutableArray');
plus.ios.invoke(iosArray,'addObject:','public.movie');
cameraVideo.plusSetAttribute('mediaTypes',iosArray);
cameraVideo.plusSetAttribute('videoMaximumDuration',10.000000000000001);
console.log('du:'+cameraVideo.plusGetAttribute('videoMaximumDuration'));
var UIApplicationClass = plus.ios.importClass("UIApplication");
var UIAppObj = UIApplicationClass.sharedApplication();
var del = plus.ios.invoke(UIAppObj,"delegate");
// console.log(JSON.stringify(del));
var appWindowObj = plus.ios.invoke(del,"window");
var appRootController = plus.ios.invoke(appWindowObj,"rootViewController");
plus.ios.invoke(appRootController,"presentViewController:animated:completion:",cameraVideo,"YES",null);
运行环境
[系统版本]ios 11.4.1
[mui版本]9.0.8.201806081953
联系方式
[QQ]909178457
[电话]13027785816
4***@qq.com
试了,限制录制视频时间没有效果
2018-09-19 17:06
DCloud_heavensoft
用HBuilderX最新版
2018-09-19 23:09
首席劝退师 (作者)
回复 DCloud_heavensoft:.1.50.20180918-alpha的版本还是不行
2018-09-30 11:15
首席劝退师 (作者)
回复 DCloud_heavensoft:HBuilderX.0.1.51.20181008-alpha.full.zip我又重新装了一般还是不行,能看看怎么回事不;
2018-10-08 09:15
DCloud_App_Array
首先确认代码中正确配置了videoMaximumDuration参数。尝试把手机上的HBuilder删除后重新真机运行,查看下plus.runtime.innerVersion的值。如果还不行的话确认下设备型号及iOS版本。
2018-10-08 13:08