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

@redbeemedia/javascript-player-plugins

v1.5.1

Published

Plugins Javascript Module

Downloads

11

Readme

RedBeeMedia JavaScript Player Plugins

Plugins for the JavaScript player.

Available plugins

Mux Data Plugin

Plugin for sending analytics data to Mux.

Usage

import { RedBeePlayer } from "@redbeemedia/javascript-player";
import { MuxDataPlugin } from "@redbeemedia/javascript-player-plugins";

// Setup and load the player as usual
const player = new RedBeePlayer(...);

/*
  Create a new instance of the plugin
  The muxDataMetadata property can contain custom metadata fields to be sent to Mux.
  See https://docs.mux.com/guides/data/make-your-data-actionable-with-metadata and
  https://docs.mux.com/guides/data/extend-data-with-custom-metadata#4-submitting-custom-metadata-from-mux-data-sdks for more information.
*/
const analytics = new MuxDataPlugin({
  debug: true,
  muxDataMetadata: {
    env_key: "your-mux-env-key",
    // Other custom metadata fields
  },
  privacySettings: {
    respectDoNotTrack: false,
    disableCookies: false,
  },
  locale: "" // optional locale for which the plugin will try to select a video title
});

// Add the plugin to the player
// The plugin will be initialized and start sending data to Mux as soon as the player is ready
analytics.connect(player);

// To disconnect the plugin
analytics.disconnect();

// To destroy the plugin
analytics.destroy();

Default fields that will be set on plugin initialization:

{
  "env_key": "<mux-env-key>",
  "player_software_name": "<player-software-name>",
  "player_software_version": "<player-software-version>",
  "player_name": "<player-name>",
  "player_version": "<player-version>",
  "player_mux_plugin_name": "<mux-plugin-name>",
  "player_mux_plugin_version": "<mux-plugin-version>",
  "player_init_time": "<player-init-time>",
  "view_session_id": "<view-session-id>",
  "viewer_os_family": "<viewer-os-family>",
  "viewer_os_version": "<viewer-os-version>",
  "viewer_os_architecture": "<viewer-os-architecture>",
  "viewer_device_name": "<viewer-device-name>",
  "viewer_device_category": "<viewer-device-category>",
  "viewer_device_manufacturer": "<viewer-device-manufacturer>",
  "video_id": "<video-id>",
  "video_stream_type": "<live/on-demand>",
  "video_cdn": "<video-cdn>",
  "video_duration": "<video-duration>",
  "video_title": "<video-title>",
}

Implement your own plugin

Plugins should always extend the AbstractPlugin class that defines the interface for player plugins. The AbstractPlugin class also provides some helper methods for plugins to use.

import { AbstractPlugin, IBasePluginOptions } from "./AbstractPlugin";
import type { RedBeePlayer } from "@redbeemedia/javascript-player";

export class MyCustomPlugin extends AbstractPlugin {
  constructor(options: IBasePluginOptions) {
    // Call the super constructor with the plugin debug flag.
    super(options.debug);
    // Do your plugin initialization here.
  }

  public connect(playerInstance: RedBeePlayer): void {
    // This method will be called when the plugin is loaded.
    // The plugin should connect to the player and listen for player events.
  }

  public disconnect(): void {
    // This method will be called when the plugin is unloaded.
    // The plugin should stop listening for player events.
  }

  public destroy(): void {
    // This method will be called when the plugin is destroyed.
    // The plugin should clean up any resources it has created.
  }
}