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";
const player = new RedBeePlayer(...);
const analytics = new MuxDataPlugin({
debug: true,
muxDataMetadata: {
env_key: "your-mux-env-key",
},
privacySettings: {
respectDoNotTrack: false,
disableCookies: false,
},
locale: ""
});
analytics.connect(player);
analytics.disconnect();
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) {
super(options.debug);
}
public connect(playerInstance: RedBeePlayer): void {
}
public disconnect(): void {
}
public destroy(): void {
}
}