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

brtc-js

v2.24.1

Published

baijiayun BRTC SDK

Downloads

4

Readme

百家云实时通信 SDK(BRTC SDK)

一个互动低延时 Web 实时通信解决方案。

Documentation

Modules

Classes

Events

Error

Installation

BRTC 通过 script 引用得到 BRTC 全局对象,或者也可以通过模块加载

<script src="./dist/BRTC.min.js"></script>

let BRTC = require('./dist/BRTC.min.js');

import * as BRTC from './dist/BRTC.min.js';

Usage

<div id="self-player"></div>
<div id="remote-player"></div>

const client = BRTC.createClient({
  mode: 'live',
  codec: 'h264',
  appId: ''
});

client
  .on('stream-added', (data) => {
    let remotestream = data.stream;
    console.log(`user ${remotestream.getUserId()} publish`);
    client.subscribe(remotestream, {video: true, audio: true}).then(() => {
      console.log(`user ${remotestream.getUserId()} subscribed`);
      remotestream.play('remote-player').then(() => {
        console.log(`user ${remotestream.getUserId()} played`);
      });
    })
    .catch(error) {
      console.log('subscribe fail', error);
    }
  })
  .on('stream-removed', (data) => {
    let remotestream = data.remotestream;
    console.log(`user ${remotestream.getUserId()} unpublish`);
    remotestream.stop();
    client.unsubscribe(remotestream).then(() => {
      console.log(`user ${remotestream.getUserId()} unsubscribe success`);
    })
    .catch(error) {
      console.log('unsubscribe fail');
    }
  })
  .on('stream-subscribed', (data) => {
    let remotestream = data.stream;
    console.log(`user ${remotestream.getUserId()} subscribe success`);
  })
  .on('stream-published',(data) => {
    let localstream = data.stream;
    localstream.play('self-player').then(() => {
      console.log('localstream play success');
    });
    console.log(`user ${localstream.getUserId()} publish success`);
  })
  .on('stream-updated', (data) => {
    let stream = data.stream;
    console.log(`user ${stream.getUserId()} update`);
  });

client.join('roomId', 123, 'sig').then(() => {
  const localstream = BRTC.createStream({
    video: true,
    audio: true,
    cameraId: 'herhjerh4th',
    microphoneId: '976i5j64u6u56'
  });

  localstream.setVideoProfile('720p');
  localstream.setAudioProfile('standard');

  localstream.init(() => {
    client.publish(localstream).then(() => {
      console.log('localstream published');
    });
  })
  .catch(error) {
    console.log('create localstream fail', error);
  }
});

Demo

提供一个使用 Vue 编写的 demo 在线预览 下载