0.6.21 • Published 19 days ago

hy-rtc-sdk v0.6.21

Weekly downloads
-
License
-
Repository
-
Last release
19 days ago

hy-rtc-skd 核心模块

版本 0.6.21 更新内容
  • 升级依赖
    • hy-rtc-core@1.38.0
版本 0.6.20 更新内容
  • 升级依赖
    • hy-rtc-core@1.37.2
版本 0.6.16 更新内容
  • 优化
    • 优化 initSocket 中的 sdkParams 新增 proactivelyDisconnect 主动断开字段
版本 0.6.13 更新内容
  • 优化

    • 优化 disconnect 断开 并清空 房间列表和设备列表
版本 0.6.12 更新内容
  • 优化
    • 优化 clientClosed 的回调事件时间
    • 优化 audioPushing 和 videoPushing 字段判断, 根据 consumers 中的 track判断
版本 0.6.11 更新内容
  • 固定依赖
    • 固定 hy-rtc-core 依赖版本
版本 0.6.10 更新内容
  • 方法名字替换
    • mediaClientIdFn
      • 替换名: getMediaClientId
      • 用 途: 获取中颗粒度 clientId
    • mediaServicesFn
      • 替换名: setMediaServices
      • 用 途: 设置 mediaServices 内容
    • subscribeFn
      • 替换名: setSubscribe
      • 用 途: 订阅消息
    • unsubscribeFn
      • 替换名: setUnsubscribe
      • 用 途: 取消订阅
版本 0.6.8 更新内容
  • 功能优化
    • initSocket 方法新增字段 recvForceTcp(强制TCP拉流true/false)
版本 0.6.7 更新内容
  • 功能优化
    • monitor 等功能,兼容苹果默认浏览器画面
版本 0.6.6 更新内容
  • 升级依赖
    • hy-rtc-core
  • 功能优化
    • monitor 等功能,在设备报错时候自动调用 failCallback 方法
版本 0.6.6 更新内容
  • 升级依赖

    • hy-rtc-core
版本 0.6.4 更新内容
  • 新增功能

    • getLocalVideoStream (获取本地当前视频流)
    • getLocalAudioStream (获取本地当前音频流)
    • getRoom (当前房间数据)
    • replaceAudioStream (更换房间中的音频流)
版本 0.6.2 更新内容
  • 优化功能 - 优化小颗粒度参数,字段“host”、“port”、“path”、“useSSL”

负责主要功能

  • 设备监听 (monitorlisten)
  • 设备监控 (monitor
  • 加入频道 (channelInFn
  • 视频会议 (videoMeetingIn
  • 语音通话 (intercomcall)
  • 视频通话 (videocall)
  • 发起广播 (broadcast)
  • 视频录制 (recordVideo)

接入流程

// npm 依赖包安装
npm i hy-rtc-sdk

// 在需要使用的页面引入
import HyRtcSdk from 'hy-rtc-sdk'

// 初始化
/* 连接媒体服务 */
  const hyRtcSdk = new HyRtcSdk ({
    useSSL: true, // 是否启用SSL
    host: 'host', // IP地址
    port: 'port', // 端口号
    path: 'path', // 要连接到的主机上的路径
    clientId: 'clientId', // 标识符
    userName: 'userName', // 账号
    password: 'password' // 密码
  })
  hyRtcSdk.eventEmit('open', () => {
    this.sdk = hyRtcSdk
    console.log('成功')
  })
  hyRtcSdk.eventEmit('close', () => {
    console.log('连接失败回调事件')
  })
  hyRtcSdk.eventEmit('disconnected', () => {
    console.log('绑定连接断开事件')
  })

// 事件监听
this.rtc.eventEmit('consumerResumed', (res) => {
     console.log('房间中设备开启麦克风', res)
})
this.rtc.eventEmit('consumerPaused', (res) => {
     console.log('房间中设备关闭麦克风', res)
})

服务方法

断开服务 (disconnectCompletely)
this.sdk.disconnectCompletely()

 获取运行环境信息
const obj = this.sdk.disconnectCompletely()

房间中相关方法

退出房间 (exitRoom)
this.sdk.exitRoom()

/**
         * method:房间消息
         	 const method = {
                    hangup: '挂断',
                    answer: '接听中',
                    ringing: '响铃中',
                    suspendRinging: '停止响铃'
              }
         * roomId:房间id
         * clientId:受控设备id 不传则是all,(all在双人对讲时候无效)
     */
通话中,给房间发送消息 (sendRoomMessage)
this.sdk.sendRoomMessage(method, roomId, clientId)

/**
        * notificationDeviceControl
         * @param params
         *
         左上:PTZ_LEFT_UP
         上:PTZ_UP
         右上:PTZ_RIGHT_UP
         左:PTZ_LEFT
         右:PTZ_RIGHT
         左下:PTZ_LEFT_DOWN
         下:PTZ_DOWN
         右下:PTZ_RIGHT_DOWN
         放大:PTZ_ZOOM_IN
         缩小:PTZ_ZOOM_OUT
         停止PTZ指令:PTZ_STOP(停止操作无需speed参数)
         聚焦-近:FI_FOCUS_NEAR
         聚焦-远:FI_FOCUS_FAR
         光圈-缩小:FI_IRIS_ZOOM_OUT
         光圈-放大:FI_IRIS_ZOOM_IN
         停止FI指令:FI_STOP(停止操作无需speed参数)
         * speed
         *  速度,整型;取值范围:1~8
     */
云台控制 (notificationDeviceControl)
this.sdk.notificationDeviceControl({
    command: '相关操作',
    clientId: 'clientId',
    speed: 4, '移动速度 1~8 默认4'
})
获取屏幕流
sdk.getDisplayMedia(obj.param).then((stream) => {
    resolve(stream)
}).catch((e) => {
    reject(e)
})

传入一个流,拆分成音频流和视频流
const { videoStream, audioStream } = await this.hyRtcSdk.handlerDisplayMediaStream(stream)

音频相关方法

获取本地音频列表 (audioInputListFn)
const audioInputList = this.sdk.audioInputListFn()

获取音频话语权 (audioConsumerResume)
this.sdk.audioConsumerResume(roomId, 成功回调,失败回调)

释放音频话语权 (audioConsumerResume)
this.sdk.audioConsumerPaused(roomId, 成功回调,失败回调)

视频相关方法

获取本地视频列表 (videoInputListFn)
const videoInputListFn = this.sdk.videoInputListFn()

获取视频话语权 (videoConsumerResume)
this.sdk.videoConsumerResume(roomId, 成功回调,失败回调)

释放视频话语权 (videoConsumerPaused)
this.sdk.videoConsumerPaused(roomId, 成功回调,失败回调)


/**
	* roomId 非必填 (不填写使用全局的,填写就是针对房间操作)
*/
替换个人房间中的VideoStream (videoStream, roomId)
this.sdk.replaceVideoStream(videoStream, roomId)

相关参数解释

功能参数文档

功能回调内容

房间methodType状态

报错信息文档

0.6.21

19 days ago

0.6.20

19 days ago

0.6.19

2 months ago

0.6.17

4 months ago

0.6.14

4 months ago

0.6.13

4 months ago

0.6.16

4 months ago

0.6.15

4 months ago

0.6.12

4 months ago

0.6.11

4 months ago

0.6.9

5 months ago

0.6.10

5 months ago

0.6.7

6 months ago

0.6.6

6 months ago

0.6.3

8 months ago

0.6.2

8 months ago

0.6.5

7 months ago

0.6.4

7 months ago

0.6.1

8 months ago

0.6.0

11 months ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.6

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.5

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.3.17

2 years ago

0.3.16

2 years ago

0.3.15

2 years ago

0.3.14

2 years ago

0.3.13

2 years ago

0.3.19

2 years ago

0.3.18

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.3.9

2 years ago

0.3.12

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.1.10

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.2

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.2.0

3 years ago