1.0.1 • Published 2 years ago

motion-remote v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

快速开始

1、安装

npm i motion-remote

2、引入

import * as Remote from 'motion-remote'

3、使用

// 容器
<video ref="remoteVideo" data-v-app="" style="object-fit:cover" webkit-playsinline="true" playsinline="true" width="960" height="540"></video>

// 配置信息
Remote.initRemote({
  video: this.$refs.remoteVideo, // 视频容器
  serverUserId: 用户名, // userId
  password: 密码, // password
  roleIndex: 2, // 角色编号
  curActionStyle: 1, // 动作编号
  backgroundIndex: 1, // 推流视频背景 0:默认 1:自定义背景
})

暴露出的方法

/**
 * 初始化数据配置
 * @param {object} obj 数据对象,video,serverUsreId,password为必选
 * /
{
  video: this.$refs.remoteVideo,  // 视频容器
  serverUserId: 15001191540,      // userId
  password: 15001191540,          // password
  roleIndex: 1,                   // 角色编号
  curActionStyle: 1,              // 动作编号
  screenMode: 0,                  // 推流视频横竖屏 0-横屏 1-竖屏
  dpiWidth: 1920,                 // 推流视频宽
  dpiHeight: 1080,                // 推流视频高
  backgroundIndex: 1,             // 推流视频背景 0:默认 1:自定义背景
  cutBackground: {                // 扣除背景 backgroundIndex值必须为1
    video: this.$refs.remoteVideo,  // 目标视频标签
    c1: this.$refs.c1,              // 获取视频截图的canavas
    c2: this.$refs.c2,              // 处理绿色背景的canvas
    scale: 1                        // 视频尺寸与输出尺寸的比例
  }
}

/**
 * 初始化
 * @param {object} config 
 */
initRemote(config)

/**
 * 获取答案
 * @param {string} content 问题文本
 */
getAnswer(content)

/**
 * 获取播报
 * @param {string} content 播报文本
 */
getBroadcast(content)

/**
 * 语音识别
 * @param {blob} audioRes 语音blob
 */
getAnswerAccordAudio(audioRes)

/**
 * 切换相机角度
 */
switchCamera()

/**
 * 释放Hive
 * @param {function} callback 回调方法
 * @returns 
 */
releaseHive(callback)
1.0.1

2 years ago

1.0.0

2 years ago