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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@poroone/trtc-harmony

v1.0.0

Published

基于 @tencentcloud/liteavsdk_professional 的鸿蒙 TRTC UTS 插件,支持 XComponent 视频渲染

Readme

trtc-harmony

鸿蒙端 TRTC 实时音视频 UTS 插件,封装 @tencentcloud/liteavsdk_professional,通过 defineNativeEmbed 嵌入 XComponent 实现视频渲染。

依赖

  • HBuilderX >= 4.62(支持鸿蒙原生组件 embed)
  • 鸿蒙真机(TRTC 不支持模拟器)

首次编译时 HBuilderX 会根据 utssdk/app-harmony/config.json 自动拉取 ohpm 依赖。若版本号失效,可在 腾讯云 SDK 下载页 查看最新版本并更新 config.json

目录结构

trtc-harmony/
├── components/
│   ├── trtc-local-view/    # 本地视频 embed 组件
│   └── trtc-remote-view/   # 远端视频 embed 组件
└── utssdk/app-harmony/
    ├── config.json         # ohpm 依赖
    ├── module.json5        # 权限声明
    ├── index.uts           # TRTC API 封装
    ├── trtc-video-view.ets # XComponent + defineNativeEmbed
    └── embed-init.uts      # 注册原生组件

使用示例

<script setup>
import { ref, onMounted } from 'vue'
import { createTrtcInstance, destroyTrtcInstance, TRTCAppScene, TRTCVideoStreamType } from '@/services/trtc'
import TrtcLocalView from '@/uni_modules/trtc-harmony/components/trtc-local-view/trtc-local-view.vue'
import TrtcRemoteView from '@/uni_modules/trtc-harmony/components/trtc-remote-view/trtc-remote-view.vue'
import { requestHarmonyUserPermissions, HARMONY_PERMISSION_CAMERA, HARMONY_PERMISSION_MICROPHONE } from '@/uni_modules/harmony-permissions'

const trtc = ref(null)
const localViewId = 'trtc_local_1'
const remoteViewId = 'trtc_remote_1'

onMounted(async () => {
  // #ifdef APP-HARMONY
  await new Promise<void>((resolve) => {
    requestHarmonyUserPermissions([HARMONY_PERMISSION_CAMERA, HARMONY_PERMISSION_MICROPHONE], (ok) => resolve())
  })
  // #endif

  trtc.value = createTrtcInstance()
  trtc.value.on('onEnterRoom', (result) => {
    if (result > 0) {
      trtc.value.startLocalPreview(true, localViewId)
      trtc.value.startLocalAudio()
    }
  })
  trtc.value.enterRoom({ sdkAppId, userId, userSig, roomId }, TRTCAppScene.TRTCAppSceneVideoCall)
})

onUnload(() => {
  trtc.value?.exitRoom()
  destroyTrtcInstance()
})
</script>

<template>
  <!-- #ifdef APP-HARMONY -->
  <TrtcLocalView :view-id="localViewId" />
  <TrtcRemoteView :view-id="remoteViewId" :user-id="remoteUserId" />
  <!-- #endif -->
</template>

注意事项

  1. viewId 必须与 startLocalPreview / startRemoteView 传入的 id 完全一致。
  2. defineNativeEmbed 标签名 trtcvideoview 须小写。
  3. 麦克风/摄像头权限建议通过 harmony-permissions 插件动态申请后再调用 TRTC 接口。