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

miniprogram-ar-rtmpc

v0.0.3

Published

实时连麦小程序SDK

Downloads

1

Readme

实时连麦小程序SDK

使用此组件需要依赖小程序基础库 2.2.1 以上版本,同时依赖开发者工具的 npm 构建。具体详情可查阅官方 npm 文档

准备工作

设置小程序服务类别

登录公众号平台,打开设置-基本设置-服务类目-详情-添加服务类目,目前小程序实时音视频支持这些服务类目,请选择其中一种。 设置小程序服务类别

开启实时音视频权限

登录公众号平台,打开开发-接口设置,开启实时播放音视频流并开启实时录制音视频流。 设置小程序服务类别

配置服务域名

登录公众号平台,打开开发-开发设置-服务器域名-修改,配置服务域名白名单。 设置小程序服务类别

npm构建

打开开发者工具,打开设置-项目设置-勾选'使用npm模块',npm安装moniprogram-ar-rtmpcmoniprogram-ar-pushmoniprogram-ar-play之后,点击工具-构建npm。

兼容情况

微信小程序基础库需要大于1.7.0,低版本需做兼容处理。

真机调试

开发者工具模拟器除特殊版本之外,不支持实时音视频功能,请使用真机调试。

使用说明

1.结合小程序实时连麦SDK使用
2.结合小程序推流组件小程序拉流组件使用

使用方法

  1. 安装 ar-rtmpc
npm install --save miniprogram-ar-rtmpc
  1. 会议初始化
import { XcxGuestKit } from 'miniprogram-ar-rtmpc';

//创建实例
let guest = new XcxGuestKit();
that.setData({
  guest: guest
});
//初始化
guest.initEngine(config.DEV_ID, config.APP_ID, config.APP_KEY, config.APP_TOKEN, config.APP_DOMAIN);
  1. 加入房间
//加入房间
guest.joinRTCLine(roomId, userid, JSON.stringify({ userid }));

//加入房间成功回调
guest.on("onJoinLineResult", (code, data) => {
  if (code == 0) {
    wx.showToast({
      icon: 'success',
      title: '加入房间成功',
    });
  }
  else if (code == 605) {
    wx.showToast({
      icon: 'none',
      title: '直播未开始',
    });
  }
  else {
    wx.showToast({
      icon: 'none',
      title: '加入房间失败: ' + code,
    });
  }
});
  1. 收到推流地址
//收到推流URL回调,将URL绑定到ar-push推流组件中,其他人将收到自己的视频
guest.on("onGetPushUrl", (code, data) => {
  console.log('onGetPushUrl', code, data);
  if (code === 0) {//成功
    that.setData({
      xcxUserId: data.xcxUserId,
      pushURL: data.pushURL,
      arPushcomponent: that.selectComponent("#arPush"),
    });
  } else {
    wx.showToast({
      icon: 'none',
      title: '获取房间签名失败',
    });
  }
});
  1. 退出房间
guest.leaveRoom();
//自行路由跳转

Demo源码

github