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

@100mslive/hmsvideo-web

v1.0.9

Published

A web SDK for 100mslive sfu

Downloads

341

Readme

hmsvideo-sdk

Endpoint Healthcheck

Web SDK for the 100mslive backend.

Installation

npm install @100mslive/hmsvideo-web

Usage

import { HMSPeer, HMSClientConfig, HMSClient, HMSMediaStreamConstraints } from "@100mslive/hmsvideo-web';

const peer = new HMSPeer(userName:"<userName here>",authToken:"<authToken here>")
const config = new HMSClientConfig({
    endpoint: "<endpoint URL here>"
})
const client = new HMSClient(peer, config)

// Setup handlers
client.on('connect',() => {
    // This is where we can call `join(room)`
});
client.on('disconnect', () => {});
client.on('peer-join', (room, peer) => {
    // Show a notification or toast message in the UI
});
client.on('peer-leave', (room, peer) => {
    // Show a notification or toast message in the UI
});
client.on('stream-add', (room, peer,  streamInfo) => {
    // subscribe to the stream if needed
});
client.on('stream-remove', (room, peer, streamInfo) => {
    // Remove remote stream if needed
});
client.on('broadcast', (room, peer ,message) => {
    // Show a notification or update chat UI
});

// Connect
try {
    await client.connect()
} catch(err) {
    // Handle error
}


// Join a room using a unique room id
const room = <some unique room id>
try {
    await client.join(room);
} catch(err) {
    // Handle error
}


// Get a local stream
const constraints = new HMSMediaStreamConstraints()
try {
    const localStream = await client.getLocalStream(constraints: HMSMediaStreamConstraints);
} catch(err) {
    // Handle error
}


// Publish local stream
try {
    await client.publish(localStream, room);
} catch(err) {
    // handle the error
}


// Unpublish local stream
try {
    await client.unpublish(localStream, room);
} catch(err) {
    // handle error
}


// Subscribe to a remote stream
try {
    const remoteStream = await client.subscribe(mid, roomId);
    // Do something with remoteStream
} catch(err) {
    // Handle error
}


// Unsubscribe from a stream
try {
    await client.unsubscribe(remoteStream, roomId);
} catch(err) {
    // Handle error
}


// Broadcast a payload to the room
try {
    await client.broadcast(payload, roomId);
} catch(err) {
    // Handle error
}


// Close client connection
client.disconnect();