合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
在调用showAssetsCreationDialog时,没有报错,但是不弹保存的框,有配置icon和appaname字段,
执行到 await photoHelper.showAssetsCreationDialog后 不会catch 也不继续往下执行
private async saveVideoToAlbum(localPath: string, context: common.UIAbilityContext): Promise<void> {
const srcFileUri = fileUri.getUriFromPath(localPath);
const fileExt = localPath.includes('.')
? localPath.split('.').pop()?.toLowerCase() ?? 'mp4'
: 'mp4';
const fileName = localPath.split('/').pop() || `video_${Date.now()}`;
const title = fileName.replace(/\.[^.]+$/, '');
const creationConfigs: photoAccessHelper.PhotoCreationConfig[] = [{
title: title,
fileNameExtension: fileExt,
photoType: photoAccessHelper.PhotoType.VIDEO
}];
try{
const photoHelper = photoAccessHelper.getPhotoAccessHelper(context);
const desFileUris = await photoHelper.showAssetsCreationDialog(
[srcFileUri],
creationConfigs
);
const destFile = fs.openSync(desFileUris[0], fs.OpenMode.WRITE_ONLY);
fs.copyFileSync(localPath, destFile.fd);
fs.closeSync(destFile.fd);
photoHelper.release();
KLog.i(TAG, TAG, `save video to album success, uri: ${desFileUris[0]}`);
}catch(error){
KLog.e(TAG, TAG, `save video to album error: ${JSON.stringify(error)}`);
}
}我要提问题