aibao-miniprogram-live
v1.0.9
Published
爱保科技小程序视频组件:
Downloads
5
Readme
aibao-miniprogram-live
爱保科技小程序视频组件:
- 开箱即用
- 支持三方通话
- 支持快照
- 支持呼叫挂断铃声
- 支持支持全屏切换
- 三方通话优化
使用
使用npm install aibao-miniprogram-live
小程序开发工具——>详情——>本地设置——>使用npm模块——>工具——>构建npm——>miniprogram_npm下的aibao-miniprogram-live就是视频组件
引用页面的.json文件中 "usingComponents": {"push-play": "/components/pushPlay/pushPlay"},.wxml文件中
<push-play></push-play>
,.js文件中推荐onReady生命周期函数中const pushPlay = this.selectComponent('#push-play')获取视频组件实例布局推荐页面width=100%,height=100%
调用时使用init方法
pushPlay.init({
initData: {
appId: String,
secret: String,
uploadFile: Function,
call:Boolean ,
componentPath: String,
domain: String
},
interactData: {
invite: String,
tag: String,
ext: JsonStr,
user: String,
userName: String
},
session: String
}) | 参数 | 类型 | 默认值 | 说明 | |:------:|:------: |:------: |:------| |initData |object|{}|组件初始化数据| |initData.appId |string|''|账号,对接服务时开通,非必传,和session二者必传其一,session会覆盖此字段| |initData.secret |string|''|密钥,同上| |initData.uploadFile |function|''|上传图片函数,调用方传入,返回必须为Promise对象,结构为{url:'图片url'}| |initData.call |Boolean|true|是否发起呼叫,默认发起| |initData.componentPath |string|''|组件所在绝对路径,例如'/component'| |initData.domain |string|''|视频接口域名,对接服务时告知| |interactData |object|{}|组件交互数据| |interactData.invite |string|''|被邀请人id| |interactData.tag |string|''|通话中消息传递唯一标识,调用方保证唯一性| |interactData.ext |JsonStr|'{}'|用于发起视频通话时的扩展字段| |interactData.user |string|''|发起人id| |interactData.userName |string|''|发起人名称| |interactData.caseId |string|''|单次通话唯一标识,三方通话凭证| |session |string|''|视频通话中唯一凭证,非必传,传入之后initData.appId,initData.secret不生效|事件 pushStateChange , userPlayStateChange , patrPlayStateChange , hangup snapshot
| 属性 | 类型 | 默认值 | 说明 | |:------:|:------: |:------: |:------:| |fullScreen|Boolean|false|是否开启长按全屏切换,默认关闭|