npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rongcloud/adapter-plugin-rtc

v1.1.0

Published

@rongcloud/adapter-plugin-rtc

Downloads

26

Readme

RongRTCAdapter

为融云 RTCLib v3 用户提供的桥接方案,以便于用户最小化改动的情况下可以直接升级至 RTCLib v5 - @rongcloud/plugin-rtc

依赖安装

  • 使用 RongIMLib v2 的开发者需升级至 RongIMLib v2.8 以上
    npm i @rongcloud/imlib-v2
  • 使用 RongIMLib v3 及 v4 的开发者需升级至 RongIMLib v4.3 以上
    npm i @rongcloud/imlib-v4
  • 需安装 RTCLib v5 版本
    npm i @rongcloud/plugin-rtc

安装 RongRTCAdapter

npm i @rongcloud/adapter-plugin-rtc

CHANGE

以下列出的是相较于老版本 RongRTC-v3,使用 RongRTCAdapter 所需要进行的修改内容。

桥接层中的模块,多次初始化后仅最后一次的初始化回调数据有效

Init
// 以 RongIMLib v2 举例
import { RongIMClient } from '@rongcloud/imlib-v2'
import { installer, RCRTCClient } from '@rongcloud/plugin-rtc'
import * as RongRTCAdapter from '@rongcloud/rtc-v3-adapter'

// IM 客户端初始化,此处以 IMLib 2.8 举例
const imClient = RongIMClient.init(appkey, null, { ...options })
// rtc v5 客户端初始化
const rtcClient: RCRTCClient = imClient.install(installer, { ...options })

// 初始化方式变更,不再使用 `new RongRTC()`,同时需要传递 RCRTCClient 实例
RongRTCAdapter.init({ client: rtcClient, bitrate, liveRole?, mode?, liveType? })

// 由于初始化方式变更,故模块获取方式也需要变更,现在直接通过 RongRTCAdapter 顶级变量获取
const { Room, Stream, Message, Device, Storage, StreamType, StreamSize,Mode, LiveType, ROLE } = RongRTCAdapter;

// 替换 rongRTC.changeLiveRole 接口
RongRTCAdapter.changeLiveRole(ROLE.AUCHOR)

// 反初始化,相当于原 `rongRTC.destroy()`
// 为避免内存泄露,使用该方法后,已初始化的所有功能模块将失效
RongRTCAdapter.destroy()
Room 模块
//Room 模块初始化方式不变
const room = new Room({ id, ...options })

// 加入房间时不再需要传参
room.join(/*{ id: 'userId' }*/)
Stream
// Stream 模块初始化方式不变
const stream = new Stream({ ...options })

// 发布资源时不再需要传递当前用户 id
stream.publish({ /*id: '',*/ stream: { tag, type, mediaStream }})

// 发布小流时,需先保证发布了大流数据
stream.publish({ stream: { tag, type, mediaStream, size }})

// 取消发布资源时不再需要传递当前用户 id
stream.unpublish({ /*id: '',*/ stream: { tag, type }})

// 切换大小流 不再需要传递 stream.type 字段
stream.resize({
  id: '',
  stream: {
    tag: '',
    size: StreamSize.MAX,
    // type: StreamType.AUDIO_AND_VIDEO
  }
})
Monitor 模块
new Monitor({
  stats ({ sender, received }) {
    // 废弃 sender.packetsLost

    // 以下为当个流状态数据的改动
    // const track: ITrackStat = sender.tracks[0]

    // 废弃:track.trackState
    // 废弃:track.codecImplementationName
    // 废弃:track.googFirsReceived
    // 废弃:track.googPlisReceived
    // 废弃:track.googNacksReceived
    // 废弃:track.googRenderDelayMs
    // 废弃:track.samplingRate
    // 废弃:track.googCodecName
  }
});

TODO

RongRTCAdapter(index.ts)
  • ✅ StreamType
  • ✅ StreamSize
  • ✅ Mode
  • ✅ ROLE
  • ✅ LiveType
  • ✅ LayoutMode
  • ✅ RenderMode
  • ✅ Resolution
  • ✅ RongRTCVideoFps
  • ✅ StorageType

  • ✅ Room
  • ✅ Stream
  • ✅ Message
  • ✅ Device
  • ✅ Storage
  • ✅ Monitor
  • ✅ Report

  • ✅ init()
  • ✅ destroy()
  • ✅ changeLiveRole()
Room
  • ✅ constructor()
  • ✅ join()
  • ✅ leave()
  • ✅ get()
  • ✅ getSessionId ()
  • ✅ getStats ()
Stream
  • ✅ constructor()
  • ✅ get()
  • ✅ publish()
  • ✅ unpublish()
  • ✅ subscribe()
  • ✅ unsubscribe()
  • ✅ video.disable()
  • ✅ video.enable()
  • ✅ audio.mute()
  • ✅ audio.ummute()
  • ✅ resize()

  • ✅ addPublishStreamUrl()
  • ✅ removePublishStreamUrl()
  • ✅ setMixConfig()
Device
  • ✅ constructor()
  • ✅ get()
Monitor
  • ✅ constructor()
Report
  • ✅ constructor()
  • ✅ start()
Message
  • ✅ constructor()
  • ✅ send()
Storage
  • ✅ constructor()
  • ✅ set()
  • ✅ get()
  • ✅ remove()