简介
videotrimmer是在OpenHarmony环境下,提供视频剪辑能力的三方库。
效果展示:
安装教程
ohpm install @ohos/videotrimmer
OpenHarmony ohpm环境配置等更多内容,请参考 如何安装OpenHarmony ohpm包 。
使用说明
目前支持MP4格式。
视频格式 | 是否支持 |
---|---|
MP4 | 是 |
目前支持H264
编解码格式 | 是否支持 |
---|---|
H264 | 是 |
使用VideoTrimmerView
- 构建VideoTrimmerOption对象:
.then(uint8 =>{
let imageSource = image.createImageSource(uint8.buffer as any); // 步骤一:文件转为pixelMap 然后变换 给Image组件
imageSource.createPixelMap().then(pixelmap => {
this.videoTrimmerOption = {
srcFilePath: this.filePath,
listener:{
onStartTrim: ()=>{
console.log('dodo 开始裁剪')
this.dialogController.open()
},
onFinishTrim:(path:string) => {
console.log('dodo 裁剪成功 path='+path)
this.outPath = path;