oxLivePusher

Method

论坛示例

为帮助用户更好更快的使用插件,论坛维护了一个示例,示例中包含示例代码、知识点讲解、注意事项等,供您参考。

概述

本插件封装了 直播推流live push

插件概述

1:GPUImage基础美颜 磨皮 提亮 色调调节 2.GPUImage滤镜 用户可自定义 3.动态水印 4.自定义控件 5.推流实现自研,没有集成个大平台sdk

插件接口

addEventListener

公用监听

   var ox = api.require('oxLivePusher');
   ox.addEventListener(function(ret) {
          var code = ret.code;
          // -1 连接错误
          // 0 未连接
          // 1 连接中
          // 2 已连接
          // 3 已停止
          // 其他为自定义控件事件 以控件 code分辩
               
     });
  

可用性

Android,ios系统

可提供的1.0.0

unzipFilter

解压自定义滤镜

   var ox = api.require('oxLivePusher');
   ox.unzipFilter({
                            filters: [{
                                name: '纯真',
                                zipPath: 'widget://resource/filter/001.zip'
                            }, {
                                name: '清新',
                                zipPath: 'widget://resource/filter/002.zip'
                            }]
                        });

可用性

Android,ios系统

可提供的1.0.0

open

打开界面

   var ox = api.require('oxLivePusher');
   ox.open({
                fixedOn: api.frameName,
                rect: {
                    x: 0,
                    y: 0,
                    w: w,
                    h: h
                },
                fixed: true,
                url: "rtmp://95718.livepush.myqcloud.com/live/jiang?txSecret=929c0a0d0ecec7a6ae78130223580cad&txTime=61BD36AB",//直播地址
                components:[backBtn],// 控件  自定义控件 可选
                warterMark:{
                    pic:'widget://res/icon.png',
                    x: 20,
                    y: 40,
                    w: 30,
                    h: 30
                },//水印 字段为空则不显示水印
                backgroundHolder: 'widget://image/background.png', //视频背景图片
                data:{}//用户自定义数据 可以是vid uid 等 随点击事件返回
            });
   //控件格式  code值不能重复
   var backBtn = {
              x: w-40,
              y: 40,
              w: 20,
              h: 20,
              pic: 'widget://resource/close_preview.png',
              rect: {
                  x: 0,
                  y: 0,
                  w: 20,
                  h: 20
              },
              radius: 10,
              backgroundColor: '#EE0000',
              alpha: 0,
              border: 0,
              borderColor: '#01000000',
              text: '',
              textSize: 14,
              textColor: '#C0FF3E',
              alignment: 0,
              code: 10,
              hidden: false
          }; //自定义控件 返回按钮

可用性

Android,ios系统

可提供的1.0.0

startPreview

开始预览

    var ox = api.require('oxLivePusher');
    ox.startPreview();

可用性

Android,ios系统

可提供的1.0.0

startPush

开始推送

   var ox = api.require('oxLivePusher');
    ox.startPush();

可用性

Android,ios系统

可提供的1.0.0

stopPush

停止推送

   var ox = api.require('oxLivePusher');
    ox.stopPush();

可用性

Android,ios系统

可提供的1.0.0

isPush

是否推送

   var ox = api.require('oxLivePusher');
    ox.isPush(function(ret) {
            if(ret.code==0){
                var isPush = ret.isPush;
            }
            
        });

可用性

Android,ios系统

可提供的1.0.0

showPreview

显示预览

   var ox = api.require('oxLivePusher');
    ox.showPreview();

可用性

Android,ios系统

可提供的1.0.0

hidePreview

隐藏预览

   var ox = api.require('oxLivePusher');
    ox.hidePreview();

可用性

Android,ios系统

可提供的1.0.0

switchCamera

切换前后摄像头

   var ox = api.require('oxLivePusher');
    ox.switchCamera();

可用性

Android,ios系统

可提供的1.0.0

toggleFlashLight

闪光灯开启关闭

    var ox = api.require('oxLivePusher');
    ox.toggleFlashLight();

可用性

Android,ios系统

可提供的1.0.0

showBeautifyPanel

显示美颜面板

   var ox = api.require('oxLivePusher');
    ox.showBeautifyPanel();

可用性

Android,ios系统

可提供的1.0.0

showFilterPanel

显示滤镜面板

   var ox = api.require('oxLivePusher');
    ox.showFilterPanel();

可用性

Android,ios系统

可提供的1.0.0

updateWarterMark

更新水印

   var ox = api.require('oxLivePusher');
    ox.updateWarterMark({
                    pic:'widget://res/icon.png',
                    x: 20,
                    y: 40,
                    w: 30,
                    h: 30
                });

可用性

Android,ios系统

可提供的1.0.0

updateComponent

更新自定义组件

   var ox = api.require('oxLivePusher');
    ox.updateComponent({
              x: w-100,
              y: 40,
              w: 25,
              h: 20,
              pic: 'widget://resource/camra_preview.png',
              rect: {
                  x: 0,
                  y: 0,
                  w: 25,
                  h: 20
              },
              radius: 10,
              backgroundColor: '#EE0000',
              alpha: 0,
              border: 0,
              borderColor: '#01000000',
              text: '',
              textSize: 14,
              textColor: '#C0FF3E',
              alignment: 0,
              code: 12,
              hidden: false
          });

可用性

Android,ios系统

可提供的1.0.0

screenshot

截屏 返回base64

   var ox = api.require('oxLivePusher');
    ox.screenshot(function(ret) {
            if(ret.code==0){
                var base64 = ret.base64;
            }
            
        });

可用性

Android,ios系统

可提供的1.0.0

setMirror

设置镜像开启

   var ox = api.require('oxLivePusher');
    ox.setMirror({isMirror:true});

可用性

Android,ios系统

可提供的1.0.0

是否仍需要帮助? 请保持联络!
最后更新于 2024/04/24