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

@daily-co/daily-vcs-web

v0.0.2-alpha.3

Published

This package enables developers to render a VCSComposition inside a given DOM element in the browser.

Downloads

38

Readme

Daily VCS Web

The @daily-co/daily-vcs-web package enables developers to render a VCSComposition inside a given DOM element in the browser.

Installation

Install the package via npm or yarn:

npm install @daily-co/daily-vcs-web
# or
yarn add @daily-co/daily-vcs-web

Usage

Import the DailyVCSWebRender class from @daily-co/daily-vcs-web and create an instance to get started:

import DailyIframe from '@daily-co/daily-js';
import DailyVCSBaselineComposition from '@daily-co/vcs-composition-daily-baseline-web';
import DailyVCSWebRenderer from '@daily-co/daily-vcs-web';

const callObject = DailyIframe.createCallObject();
const rootEl = document.getElementById('vcs-wrapper'); // DOM element where the VCS composition will be rendered
const opts = {
  callObject: callObject,
  viewportSize: { w: 1280, h: 720 },
};

const renderer = new DailyVCSWebRenderer(
  callObject,
  DailyVCSBaselineComposition,
  rootEl,
  opts
);

Methods

The DailyVCSWebRenderer class provides the following methods:

  • start()

Starts the VCS composition and renders it to the specified DOM element.

renderer.start();
  • stop()

Stops the VCS composition and removes it from the DOM.

renderer.stop()
  • sendParam(paramId, value)

Sends a parameter update to the VCS composition.

renderer.sendParam('paramId', value);
  • sendParams(params)

Sends a map of parameter updates to the VCS composition.

renderer.sendParams({
  paramId1: value1,
  paramId2: value2,
  ...params
});
  • updateImageSources(images, mergeType)

Updates the image sources of the VCS composition.

renderer.updateImageSources(
  {
    imageId1: 'imageUrl1',
    imageId2: 'imageUrl2',
    // ...
  },
  'replace' // Optional: mergeType, either 'merge' or 'replace' (default is 'replace')
);
  • updateParticipantIds(participantIds, mergeType)

Updates the participantIds to render.

renderer.updateParticipantIds(
  ['participantId1', 'participantId2', ...],
  'replace' // Optional: mergeType, either 'merge' or 'replace' (default is 'replace')
);

Properties

The DailyVCSWebRenderer class also provides several read-only properties:

| Name | Type | Description | | ---------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------- | | rootElement | DOMElement | The DOM element where the VCS composition is rendered | | vcsApiInstance | VCSApi | The VCSApi instance returned by the VCSComposition. It can be used to send updates to the VCS composition. | | composition | VCSComposition | The VCS composition object. | | participants | string[] | An array of participantIds to render. | | params | Param[] | A map of paramId to value. It keeps track of the current state of the VCS composition. | | size | { w: number, h: number } | The render viewport size used by VCS. | | imageSources | Record<string, string> | A map of image assets. It keeps track of the current image sources |

Callbacks

The DailyVCSWebRenderer class allows you to set optional callbacks that will be triggered during specific events. The available callbacks are:

  • onStart: Called when the VCS composition starts.
  • onStop: Called when the VCS composition stops.
  • onError: Called when an error occurs during the VCS composition.
  • onParamsChanged: Called when parameter values are updated.
const opts = {
  // ... other options ...
  callbacks: {
    onStart: () => console.log('VCS composition started.'),
    onStop: () => console.log('VCS composition stopped.'),
    onError: (e) => console.log('VCS composition error:', e),
    onParamsChanged: (params) => console.log('Params changed', params),
  }
}