HarmonyOS鸿蒙Next中上传视频的时候如何对视频进行压缩

HarmonyOS鸿蒙Next中上传视频对视频进行压缩可以使用模块 @ohos/videocompressor 实现。

ohpm install [@ohos](/user/ohos)/videocompressor
let videoCompressor = new VideoCompressor();
videoCompressor.compressVideo(getContext(),this.selectFilePath,CompressQuality.COMPRESS_QUALITY_HIGH).then((data) => {
    if (data.code == CompressorResponseCode.SUCCESS) {
        console.log("videoCompressor HIGH message:" + data.message + "--outputPath:" + data.outputPath);
    } else {
        console.log("videoCompressor HIGH code:" + data.code + "--error message:" + data.message);
    }
    }).catch((err) => {
        console.log("videoCompressor HIGH get error message" + err.message);
})

更多关于HarmonyOS鸿蒙Next中上传视频的时候如何对视频进行压缩的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部