Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@100mslive/react-sdk

Package Overview
Dependencies
Maintainers
0
Versions
547
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@100mslive/react-sdk

[![Lint, Test and Build](https://github.com/100mslive/web-sdks/actions/workflows/lint-test-build.yml/badge.svg)](https://github.com/100mslive/web-sdks/actions/workflows/lint-test-build.yml) [![Bundle Size](https://badgen.net/bundlephobia/minzip/@100mslive

  • 0.10.26
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27K
increased by40.23%
Maintainers
0
Weekly downloads
 
Created
Source

100ms React SDK

Lint, Test and Build Bundle Size License Tree shaking

This package is a react wrapper over the core SDK(@100mslive/hms-video-store). An easy way to use the store, actions and notifications are provided via React hooks. Some other hooks are also provided for ease of use which wrap over the primitive ones. If someone is using class based react components, they'll be better off with using the core sdk directly.

Installation

// npm
npm install @100mslive/react-sdk@latest --save

// yarn
yarn add @100mslive/react-sdk@latest

Usage

Add HMSRoomProvider from @100mslive/react-sdk at the top level of your component tree where you want to use the hooks. Wihout this the hooks will throw an error.

<HMSRoomProvider>
   <YourComponent></YourComponent>
</HMSRoomProvider>

By default, when using HMSRoomProvider room leave will be called when you are leaving/closing the tab. To disable this behaviour, you can pass leaveOnUnload as false

NOTE: The above leave might or might not be successfully sent to server as it depends on the browser implementation. This works on chromium based browsers.

Primitive Hooks

These are hooks wrapper over the sdk things.

  • useHMSStore - to get any state from store
  • useHMSActions - hmsActions to perform any actions
  • useHMSNotifications - to receive any new notifications/error for the room
  • useHMSVanillaStore - return the store object directly to be used in non react context
  • useHMSStatsStore - to get webrtc related stats

Helpful Hooks

  • useVideo - attaching and detaching video based on trackId
  • useVideoList - helpful to build a paginated gallery view of video tiles
  • useScreenShare - to toggle screenshare
  • useCustomEvent - to add custom events
  • useDevices - returns a list of all A/V devices
  • useParticipants - get count of participants, participants filtered by role or metadata
  • usePreviewJoin - implementing preview + join
  • useAVToggle - to toggle mute/unmute for audio and video
  • useRemoteAVToggle - to toggle remote mute/unmute + audio volume changer on tile level
  • useAutoplayError - unblock browser autoplay block
  • useAudioLevelStyles - apply css properties on element based on it's audio level

Refer to docs for a more detailed guide.

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc