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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@brightcove/components-embed-code-modal

v1.0.7

Published

Embed Code Modal used for publishing videos

Downloads

4,115

Readme

studio-components-embed-code-modal

Usage

To build

npm run build

Development

To run this module for development clone the repo and run

npm install
npm run demo

Sign in to Studio with a Studio UI (Marketing Studio) enabled account. If necessary, click the Profile icon and then the Switch to Studio link.

Navigate to https://studio.brightcove.com/products/videocloud/media/dev/sdk:remote.

The App runs at https://localhost.brightcove.com:12345/js/app.js as described in Creating a Module

The results of the API call to retrieve players will depend on sign in permissions.

Integrating with modules

This component was built for Marketing Studio modules, such as: studio-media-module-four.

Below you will find instructions on how to use the component inside of these modules.

Install the package

npm i @brightcove/components-embed-code-modal

Import the component and required types

import {
  EmbedCodeModal,
  VideoPayload,
} from '@brightcove/components-embed-code-modal';

VideoPayload is a TypeScript interface which describes an Object that will be accepted as a prop for your <EmbedCodeModal> component.

Here is an overview of the VideoPayload interface:

  videoId: string; // Video id, required
  videoName: string; // Video title, required
  accountId: string; // BC account id, required
  posterUrl?: string; // Video poster url, not required
  duration: number; // Video duration in seconds, required

Component Props

The component currently takes in two props:

  language?: 'en' | 'es' | 'fr' | 'ko' | 'ja' | 'zh';
  video: VideoPayload;
  • The VideoPayload interface is exported by the component.
  • The language prop is optional, if not passed, the component will get the language from StudioModule.config.lang. Currently, we use this for testing in our local sandbox.

Wiring Up Through the Module

The modal will only render once the video prop has been passed into the EmbedCodeModal component.

In order to keep our components fully decoupled, we look to our parent module's for wiring up our components together.

Here's an example of how the the Media Module's VideoLibrary is wiring up two separate components in order to open the EmbedCodeModal:

const [embedVideo, setEmbedVideo] = useState<VideoPayload>(null);

const handleAction = (event: DataGridAction) => {
  if (event.type === DataGridEvents.GetCode) {
    // build VideoPayload for EmbedCodeModal component here
    // this way we are completely de-coupling the EmbedCodeModal from the module
    const { payload: video } = event;
    setEmbedVideo({
      videoId: video.id,
      videoName: video.name,
      accountId: video.account_id,
      posterUrl: video?.images?.poster?.src,
      duration: video.duration,
    });
  }
};
  1. The Media Module imports both the DataGrid & EmbedCodeModal components. Neither component are coded to be aware of the other.
  2. The DataGrid component dispatches the GetCode action to tell its parent module: I would like to retrieve some code, go and do that, however your module handles this action.
  3. The Media Module handles this action by creating a new payload with the video information handed off by the DataGrid. It knows that it wants to open the EmbedCodeModal, so it will look to the VideoPayload interface to create what it needs.
  4. This video object is set to the module's local state.
  5. Within our JSX, our EmbedCodeModal should be passing this video object to the component: <EmbedCodeModal video={embedVideo} />
  6. Anytime that embedVideo updates in the module - it triggers the Embed Code Modal to open.

The reasons we have wired things up this way has been to achieve our goals of keeping micro-frontends decoupled. The EmbedCodeModal & the DataGrid are not interacting directly with each other. The DataGrid is providing video data that is being used, but when it triggers a Get Code event, it can just send an entire Video Object along with it. It doesn't need to know exactly what information the Embed Code Modal needs in order to successfully operate.

Likewise, the Embed Code Modal could be triggered by any other number of interfaces, and this abstraction helps us better prepare for the integrations coming in our future.