更新记录

1.3.4(2024-04-26)

特效调整

1.3.3(2024-04-07)

添加录制时长颜色maxTimeColor自定义

1.3.2(2024-03-14)

调整权限问题

查看更多

平台兼容性

Android Android CPU类型 iOS
适用版本区间:4.4 - 14.0 armeabi-v7a:支持,arm64-v8a:支持,x86:支持 适用版本区间:9 - 17

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


# 短视频录制


概述

1.滤镜 特效自定义 美颜
2.支持背景音乐
3.支持变速,录制时长自定义
4.界面控件样式自定义

温馨提示

 let ox = this.$refs.recorder;

  监听事件
  var globalEvent = weex.requireModule('globalEvent');
  globalEvent.addEventListener("actionCallback", function (e) {
           var code= e.code;
          //code -1 合并失败 0 关闭事件 1 录制完成事件 2 音乐搜索事件 3 上传事件 4预览确认按钮点击事件

    });

模块接口

unzipFilter

解压初始化滤镜


   //解压滤镜 zipPath 可以为http网络资源 用户可自己定义 格式参考 static/filter下zip内格式
    const ox = uni.requireNativePlugin('Jiang-OxVideoRecorder');
      ox.unzipFilter({
        filters: [{
          name: '初心',
          zipPath: '/static/filter/persion/chuxin.zip'
        }, {
          name: '白皙',
          zipPath: '/static/filter/persion/002.zip'
        }, {
          name: '白雪',
          zipPath: '/static/filter/persion/003.zip'
        }, {
          name: '初恋',
          zipPath: '/static/filter/persion/004.zip'
        }, {
          name: '动人',
          zipPath: '/static/filter/persion/005.zip'
        }, {
          name: '非凡',
          zipPath: '/static/filter/persion/006.zip'
        }, {
          name: '告白',
          zipPath: '/static/filter/persion/007.zip'
        }, {
          name: '活泼',
          zipPath: '/static/filter/persion/008.zip'
        }, {
          name: '慕斯',
          zipPath: '/static/filter/persion/009.zip'
        }, {
          name: '奶茶',
          zipPath: '/static/filter/persion/010.zip'
        }]
      });

unzipEffect

初始化特效 可以为http网络资源


   //解压滤镜 zipPath 可以为http网络资源 用户可自己定义 格式参考 static/filter下zip内格式
    const ox = uni.requireNativePlugin('Jiang-OxVideoRecorder');
     ox.unzipEffect({
        effects: [{
          name: '爱心泡泡',
          zipPath: '/static/effect/axpp.zip'
        },{
          name: '蝴蝶',
          zipPath: '/static/effect/hd.zip'
        },{
          name: '花火',
          zipPath: '/static/effect/hh.zip'
        },{
          name: '飘花瓣',
          zipPath: '/static/effect/phb.zip'
        },{
          name: '下雪',
          zipPath: '/static/effect/xx.zip'
        },{
          name: '羽毛',
          zipPath: '/static/effect/yumao.zip'
        }]
      });

open

打开录制界面

示例代码

//开启录制界面
     let ox = this.$refs.recorder;
        ox.open({
          maxTime: 60, //录制时长 秒
          countDownTime:5, //倒计时 时长 秒
          isSaveAlbum: true, //录制完成是否保持相册
          openBeauty:false,//基础美颜是否开启
          closeBtn:'/static/arrow-left.png',// 关闭按钮
          btnRecordingHiden:true,//录制中按钮是否隐藏
          musicBtn: { //音乐按钮事件 code 2 音乐搜索
            x: w/2-70,
            y: 50,
            w: 140,
            h: 30,
            pic:'/static/ic_camera_music.png',
            hidden: false
          },
          uploadBtn: { //上传按钮是否显示 code 3 上传按钮事件
            x: w-110,
            y: h-110,
            w: 50,
            h: 50,
            showTitle:true,
             pic:'/static/logo.png',
            hidden: false
          },
          deleteBtn: { //删除 按钮
            x: w-130,
            y: h-110,
            w: 40,
            h: 40,
            pic:'/static/ic_camera_record_delete.png',
            hidden: false
          },
          nextBtn: { //下一步按钮
            x: w-60,
            y: h-105,
            w: 25,
            h: 25,
            pic:'/static/ic_camera_record_done.png',
            hidden: false
          },
          switchBtn: {//摄像头更换按钮
            x: w-60,
            y: 60,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_switch_camera_light.png',
            hidden: false
          },
          beautyBtn: {//美化按钮
            x: w-60,
            y: 120,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_beauty_light.png',
            hidden: false
          },
          effectBtn: {//特效按钮
            x: w-60,
            y: 180,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_sticker_light.png',
            hidden: false
          },
          speedBtn: {//速度按钮
            x: w-60,
            y: 240,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_speed_off_light.png',
            pic:'/static/ic_camera_speed_on_light.png',
            hidden: false
          },
          cutDownBtn: {//倒计时按钮
            x: w-60,
            y: 300,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_count_down_light.png',
            hidden: false
          },
          flashBtn: {//闪光灯按钮
            x: w-60,
            y: 360,
            w: 50,
            h: 50,
            showTitle:true,
            pic:'/static/ic_camera_flash_off.png',
            pic1:'/static/ic_camera_flash_on.png',
            hidden: false
          },
          progress: {//进度条
            x: 0,
            y: 40,
            w: w,
            h: 3,
            color:'#FF0000',
            hidden: false
          },
          recordTime: {//录制时间进度展示00:00
            x: 80,
            y: 55,
            w: 40,
            h: 20,
            textSize:14,
            hidden: false
          },
          recordBtn: {//录制点击按钮
            x: w/2-40,
            y: h-130,
            w: 80,
            h: 80,
            color:'#FF0000'
          }
        });

clearCache

清理缓存

示例代码

const ox = uni.requireNativePlugin('Jiang-OxVideoRecorder');
ox.clearCache();//清理缓存

resume

恢复录制

示例代码

ox.resume();

pause

暂停录制

示例代码

ox.pause();

updateMusic

更新音乐

示例代码

ox.updateMusic({
          "name": "双节棍",
          "path": "http://dldir1.qq.com/hudongzhibo/LiteAV/demomusic/testmusic1.mp3"
        });

show

显示

示例代码

ox.show();

hide

隐藏

示例代码

ox.hide();

getCover

获取封面 path 视频地址

示例代码

ox.getCover({path:''}, result => {
          //code 0 
          var code = result.code;
          if (code == 0) {
            var cover = result.cover
          }
        });

addWaterMark

视频添加水印

示例代码

ox.addWaterMark({
                        path:'',//视频地址
                        watermark:'http://', 水印网站
                        x:20,
                        y:20,
                        w:80,
                        h:100
                     }, result => {
          //code 0 
          var code = result.code;
          if (code == 0) {
            var path = result.path
          }
        });

隐私、权限声明

1. 本插件需要申请的系统权限列表:

摄相头权限CAMERA 麦克风权限RECORD_AUDIO 存储权限WRITE_EXTERNAL_STORAGE READ_EXTERNAL_STORAGE

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问