//获取本地视频
select_video(){
var _this = this;
uni.chooseVideo({
maxDuration:30, //拍摄视频最长拍摄时间,单位秒
count:1, //上传视频的数量
sourceType:['camera','album'],
success: (res) => {
console.log(res.tempFilePath)
console.log(res.tempFile)
_this.preview_video = res.tempFilePath;
_this.video_src = res.tempFile;
_this.file_name = _this.video_src.name;
// console.log(_this.preview_video)
// console.log(_this.video_src)
_this.selected = true;
_this.is_video = 1;
}
})
},
- 发布:2020-06-16 19:04
- 更新:2020-06-18 11:03
- 阅读:1601
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15.4
HBuilderX类型: 正式
HBuilderX版本号: 2.7.9
手机系统: Android
手机系统版本号: Android 10
手机厂商: 华为
手机机型: mate10Pro
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
预期可以拿到tempFile的返回结果
预期可以拿到tempFile的返回结果
实际结果:
拿不到
拿不到
bug描述:
uni.chooseVideo在真机选择图片后,返回结果只有tempFilePath是正确的,附带更多信息的tempFile都是undefined。
//获取本地视频
select_video(){
var _this = this;
uni.chooseVideo({
maxDuration:30, //拍摄视频最长拍摄时间,单位秒
count:1, //上传视频的数量
sourceType:['camera','album'],
success: (res) => {
console.log(res.tempFilePath)
console.log(res.tempFile)
_this.preview_video = res.tempFilePath;
_this.video_src = res.tempFile;
_this.file_name = _this.video_src.name;
// console.log(_this.preview_video)
// console.log(_this.video_src)
_this.selected = true;
_this.is_video = 1;
}
})
},
控制台信息:
19:00:05.084 App Hide at App.vue:10
19:00:08.320 App Show at App.vue:7
19:00:08.410 file:///storage/emulated/0/Pictures/Screenshots/SVID_20200421_222327_1.mp4 at pages/release/release.vue:168
19:00:08.435 undefined at pages/release/release.vue:169
19:00:08.459 TypeError: undefined is not an object (evaluating '_this.video_src.name')
1 个回复
DCloud_UNI_GSQ
success 返回参数说明
参数 类型 说明 平台差异说明说明
tempFilePath String 选定视频的临时文件路径
tempFile File 选定的视频文件 仅H5(2.6.15+)支持