foxconn-yumeeting-sdk-js
TypeScript icon, indicating that this package has built-in type declarations

0.5.3 • Public • Published

ion-sdk-js

Frontend sdk for the Ion backend.

Installation

npm install ion-sdk-js

Usage

import { Client, LocalStream, RemoteStream } from 'ion-sdk-js';
import { IonSFUJSONRPCSignal } from 'ion-sdk-js/lib/signal/json-rpc-impl';
const signal = new IonSFUJSONRPCSignal("wss://ion-sfu:7000/ws");
const client = new Client(signal);
signal.onopen = () => client.join("test session", "test uid")

// Setup handlers
client.ontrack = (track: MediaStreamTrack, stream: RemoteStream) => {
    // mute a remote stream
    stream.mute()
    // unmute a remote stream
    stream.unmute()

    if (track.kind === "video") {
         // prefer a layer
         stream.preferLayer("low" | "medium" | "high")
    }
});

// Get a local stream
const local = await LocalStream.getUserMedia({
    audio: true,
    video: true,
    simulcast: true, // enable simulcast
});

// Publish stream
client.publish(local);

// mute local straem
local.mute()

// unmute local stream
local.unmute()

// create a datachannel
const dc = client.createDataChannel("data")
dc.onopen = () => dc.send("hello world")

// Close client connection
client.close();

发布到npm仓库步骤: 1.设置仓库地址为npm官方仓库地址(国内大部分都使用阿里淘宝镜像,如果没改publish会失败) npm config set registry https://registry.npmjs.org/ 2.检查是否登录npm账号,需要登录npm才能发布新版本 npm whoami 如果报错则需要登录 npm login Username: Password: Email: (this IS public) 376942103@qq.com Logged in as xxxxx on https://registry.npmjs.org/. 3.推送新版本命令 npm run prepare npm publish

Readme

Keywords

Package Sidebar

Install

npm i foxconn-yumeeting-sdk-js

Weekly Downloads

14

Version

0.5.3

License

MIT

Unpacked Size

1.19 MB

Total Files

43

Last publish

Collaborators

  • x4code
  • larry-arun
  • zphdev